Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmation for operations #81

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion lib/Localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Labels = {
err1ignition: 'Theft Alarm Notification. Illegal Vehicle Movement Occurred.',
err1silent: 'Theft Alarm Notification. Unauthorized Vibration Occurred.',
err1other: 'Illegal Access Occurred.',
confirm: 'Confirm action execution',
confirm: 'Default confirm action execution',
batteryHeater: 'The battery is warming up',
preACContInfo: 'Pre A/C did not fulfill Permission conditions. Please check conditions:\n'
+ 'Power supply mode of the electric motor switch: OFF\n'
Expand All @@ -29,6 +29,24 @@ const Labels = {
+ 'Quick charging is not being performed\n'
+ 'The EV remote-ECU is normal\n'
+ 'The plug-in hybrid EV system is normal\n ',
evseSlow: 'Confirmation: EVSE Slow Charge',
evseFastCharge: 'Confirmation: EVSE Fast Charge',
evseDisableCharge: 'Confirmation: EVSE Disable Charger',
cooling10Mins: 'Confirmation: Cooling Mode 10 Mins',
cooling20Mins: 'Confirmation: Cooling Mode 20 Mins',
cooling30Mins: 'Confirmation: Cooling Mode 30 Mins',
windscreen10Mins: 'Confirmation: Windscreen Mode 10 Mins',
windscreen20Mins: 'Confirmation: Windscreen Mode 20 Mins',
windscreen30Mins: 'Confirmation: Windscreen Mode 30 Mins',
heating10Mins: 'Confirmation: Heating Mode 10 Mins',
heating20Mins: 'Confirmation: Heating Mode 20 Mins',
heating30Mins: 'Confirmation: Heating Mode 30 Mins',
airconOn: 'Confirmation: Air conditioner On',
airconOff: 'Confirmation: Air conditioner Off',
headlightsOn: 'Confirmation: Headlights On',
headlightsOff: 'Confirmation: Headlights Off',
parkinglightsOn: 'Confirmation: Parkinglights On',
parkinglightsOff: 'Confirmation: Parkinglights Off',
};

function getLabels() {
Expand Down
20 changes: 19 additions & 1 deletion lib/RussianLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,25 @@ const RussianLabels = {
err1ignition: 'Предупреждение противоугонной системы. Попытка доступа незарегистрированным ключем.',
err1silent: 'Предупреждение противоугонной системы. Зарегистрирована вибрация автомобиля.',
err1other: 'Предупреждение противоугонной системы. Нелегальный доступ к автомобилю.',
confirm: 'Подтверждение выполнения операции',
confirm: 'Подтверждение выполнения операции по умолчанию',
batteryHeater: 'Силовая батарея разогревается',
cooling10Mins: 'Подтверждение: Режим Охлаждения на 10 Мин.',
cooling20Mins: 'Подтверждение: Режим Охлаждения на 20 Мин.',
cooling30Mins: 'Подтверждение: Режим Охлаждения на 30 Мин.',
windscreen10Mins: 'Подтверждение: Обогрев лобового окна на 10 мин.',
windscreen20Mins: 'Подтверждение: Обогрев лобового окна на 20 мин.',
windscreen30Mins: 'Подтверждение: Обогрев лобового окна на 30 мин.',
heating10Mins: 'Подтверждение: Режим Отопителя на 10 мин.',
heating20Mins: 'Подтверждение: Режим Отопителя на 20 мин.',
heating30Mins: 'Подтверждение: Режим Отопителя на 30 мин.',
airconOn: 'Подтверждение: Включить Климат контроль',
airconOff: 'Подтверждение: Отключить Климат Контроль',
headlightsOn: 'Подтверждение: Включить Фары',
headlightsOff: 'Подтверждение: Выключить Фары',
parkinglightsOn: 'Подтверждение: Включить Парковочные огни',
parkinglightsOff: 'Подтверждение: Выключить Парковочные огни',
evseSlow: 'Подтверждение: EVSE Медленая зарядка',
evseFastCharge: 'Подтверждение: EVSE Быстрая зарядка',
evseDisableCharge: 'Подтверждение: EVSE Отключить зарядку ',
};
module.exports.RussianLabels = RussianLabels;
32 changes: 23 additions & 9 deletions lib/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ const defaultSettings = {
confirm: 'sms',
batteryHeater: 'none',
preACContInfo: 'none',
cooling10Mins: 'sms',
cooling20Mins: 'sms',
cooling30Mins: 'sms',
windscreen10Mins: 'sms',
windscreen20Mins: 'sms',
windscreen30Mins: 'sms',
heating10Mins: 'sms',
heating20Mins: 'sms',
heating30Mins: 'sms',
airconOn: 'sms',
airconOff: 'sms',
headlightsOn: 'sms',
headlightsOff: 'sms',
parkinglightsOn: 'sms',
parkinglightsOff: 'sms',
evseSlow: 'none',
evseFastCharge: 'none',
evseDisableCharge: 'none',
},
batteryFactory: 1.063829787,
};
Expand Down Expand Up @@ -132,15 +150,11 @@ function readConfig() {
if (!configJson.notifications) {
configJson.notifications = defaultSettings.notifications;
}
if (!configJson.notifications.confirm) {
configJson.notifications.confirm = defaultSettings.notifications.confirm;
}
if (!configJson.notifications.batteryHeater) {
configJson.notifications.batteryHeater = defaultSettings.notifications.batteryHeater;
}
if (!configJson.notifications.preACContInfo) {
configJson.notifications.preACContInfo = defaultSettings.notifications.preACContInfo;
}
Object.keys(defaultSettings.notifications).forEach((k) => {
if (!configJson.notifications[k]) {
configJson.notifications[k] = defaultSettings.notifications[k];
}
});
if (!configJson.cron) {
configJson.cron = defaultSettings.cron;
}
Expand Down
10 changes: 9 additions & 1 deletion lib/smartthingsConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ async function updateSmartthingsDevices() {
}
}

function getActionNotification(device, rc) {
const notification = rc.notifications[device.actionId];
if (notification === undefined || notification === null) {
return rc.notifications.confirm;
}
return notification;
}

function executeActionRes(rc, device) {
if (device && device.actionId === 'forceUpdate') {
updateSmartthingsDevices().then(() => {
Expand All @@ -398,7 +406,7 @@ function executeActionRes(rc, device) {
const promise = executeAction(device.id, rc);
if (promise) {
promise.then(async () => {
const notification = rc.notifications.confirm;
const notification = getActionNotification(device, rc);
if (notification === 'both' || notification === 'sms') {
addSMSNotification2(`${device.actionId} successfully executed`, rc);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartthings-phevctl",
"version": "1.5.10",
"version": "1.6.0",
"description": "smartthings remote ctrl",
"main": "smartthings-phevctl.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions ui/asset-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
"main.css": "/static/css/main.7b86c5c1.chunk.css",
"main.js": "/static/js/main.d8cb817e.chunk.js",
"main.js.map": "/static/js/main.d8cb817e.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.bc57b7d3.js",
"runtime-main.js.map": "/static/js/runtime-main.bc57b7d3.js.map",
"runtime-main.js": "/static/js/runtime-main.92016c65.js",
"runtime-main.js.map": "/static/js/runtime-main.92016c65.js.map",
"static/css/2.54787924.chunk.css": "/static/css/2.54787924.chunk.css",
"static/js/2.c5ab04a9.chunk.js": "/static/js/2.c5ab04a9.chunk.js",
"static/js/2.c5ab04a9.chunk.js.map": "/static/js/2.c5ab04a9.chunk.js.map",
"static/js/3.03f8f9b3.chunk.js": "/static/js/3.03f8f9b3.chunk.js",
"static/js/3.03f8f9b3.chunk.js.map": "/static/js/3.03f8f9b3.chunk.js.map",
"static/js/3.52e02c89.chunk.js": "/static/js/3.52e02c89.chunk.js",
"static/js/3.52e02c89.chunk.js.map": "/static/js/3.52e02c89.chunk.js.map",
"index.html": "/index.html",
"static/css/2.54787924.chunk.css.map": "/static/css/2.54787924.chunk.css.map",
"static/css/main.7b86c5c1.chunk.css.map": "/static/css/main.7b86c5c1.chunk.css.map",
"static/js/2.c5ab04a9.chunk.js.LICENSE.txt": "/static/js/2.c5ab04a9.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.bc57b7d3.js",
"static/js/runtime-main.92016c65.js",
"static/css/2.54787924.chunk.css",
"static/js/2.c5ab04a9.chunk.js",
"static/css/main.7b86c5c1.chunk.css",
Expand Down
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Outlander PHEV Smartthings server</title><link href="/static/css/2.54787924.chunk.css" rel="stylesheet"><link href="/static/css/main.7b86c5c1.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"03f8f9b3"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonpremote-ctrl-ui"]=this["webpackJsonpremote-ctrl-ui"]||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="/static/js/2.c5ab04a9.chunk.js"></script><script src="/static/js/main.d8cb817e.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Outlander PHEV Smartthings server</title><link href="/static/css/2.54787924.chunk.css" rel="stylesheet"><link href="/static/css/main.7b86c5c1.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"52e02c89"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonpremote-ctrl-ui"]=this["webpackJsonpremote-ctrl-ui"]||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="/static/js/2.c5ab04a9.chunk.js"></script><script src="/static/js/main.d8cb817e.chunk.js"></script></body></html>
2 changes: 0 additions & 2 deletions ui/static/js/3.03f8f9b3.chunk.js

This file was deleted.

Loading