Skip to content

Commit

Permalink
### 2.0.10 (2020-06-20)
Browse files Browse the repository at this point in the history
* (bluefox) Added "Do not overwrite state if it has the required value" option
  • Loading branch information
GermanBluefox committed Jun 20, 2020
1 parent 5516738 commit 0666b57
Show file tree
Hide file tree
Showing 30 changed files with 252 additions and 119 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ sendTo(
The adapter will read all actual values for IDs defined in this scene and save it as configured ones.

## Changelog
### 2.0.10 (2020-06-20)
* (bluefox) Added "Do not overwrite state if it has the required value" option

### 2.0.9 (2020-06-17)
* (bluefox) The colors are corrected

Expand Down
16 changes: 8 additions & 8 deletions admin/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"files": {
"main.css": "./static/css/main.d4bed9c6.chunk.css",
"main.js": "./static/js/main.b344d9cb.chunk.js",
"main.js.map": "./static/js/main.b344d9cb.chunk.js.map",
"main.js": "./static/js/main.8c72441e.chunk.js",
"main.js.map": "./static/js/main.8c72441e.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.8cdd9b0f.js",
"runtime-main.js.map": "./static/js/runtime-main.8cdd9b0f.js.map",
"static/css/2.9ba4c952.chunk.css": "./static/css/2.9ba4c952.chunk.css",
"static/js/2.cafef96c.chunk.js": "./static/js/2.cafef96c.chunk.js",
"static/js/2.cafef96c.chunk.js.map": "./static/js/2.cafef96c.chunk.js.map",
"static/js/2.7adffe7b.chunk.js": "./static/js/2.7adffe7b.chunk.js",
"static/js/2.7adffe7b.chunk.js.map": "./static/js/2.7adffe7b.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.435bc6ed659653c95c4cc7f3f6321d03.js": "./precache-manifest.435bc6ed659653c95c4cc7f3f6321d03.js",
"precache-manifest.d83f2371a2d3f7e50560790a815198bd.js": "./precache-manifest.d83f2371a2d3f7e50560790a815198bd.js",
"service-worker.js": "./service-worker.js",
"static/css/2.9ba4c952.chunk.css.map": "./static/css/2.9ba4c952.chunk.css.map",
"static/css/main.d4bed9c6.chunk.css.map": "./static/css/main.d4bed9c6.chunk.css.map",
"static/js/2.cafef96c.chunk.js.LICENSE.txt": "./static/js/2.cafef96c.chunk.js.LICENSE.txt"
"static/js/2.7adffe7b.chunk.js.LICENSE.txt": "./static/js/2.7adffe7b.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.8cdd9b0f.js",
"static/css/2.9ba4c952.chunk.css",
"static/js/2.cafef96c.chunk.js",
"static/js/2.7adffe7b.chunk.js",
"static/css/main.d4bed9c6.chunk.css",
"static/js/main.b344d9cb.chunk.js"
"static/js/main.8c72441e.chunk.js"
]
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "9f750da1f52ab59ce6fd6ed06aeb8739",
"revision": "f94da838fa37bde34c356e8a904f65e6",
"url": "./index.html"
},
{
"revision": "976f1d8e61d56c138e70",
"revision": "bac404d6148f4a085f0f",
"url": "./static/css/2.9ba4c952.chunk.css"
},
{
"revision": "f28b7945543733bb9c22",
"revision": "2a93a3dd0bf6029e84b1",
"url": "./static/css/main.d4bed9c6.chunk.css"
},
{
"revision": "976f1d8e61d56c138e70",
"url": "./static/js/2.cafef96c.chunk.js"
"revision": "bac404d6148f4a085f0f",
"url": "./static/js/2.7adffe7b.chunk.js"
},
{
"revision": "799f3d5c27694f0f3c92bbc8286bf099",
"url": "./static/js/2.cafef96c.chunk.js.LICENSE.txt"
"url": "./static/js/2.7adffe7b.chunk.js.LICENSE.txt"
},
{
"revision": "f28b7945543733bb9c22",
"url": "./static/js/main.b344d9cb.chunk.js"
"revision": "2a93a3dd0bf6029e84b1",
"url": "./static/js/main.8c72441e.chunk.js"
},
{
"revision": "7efe789d81385b014df3",
Expand Down
2 changes: 1 addition & 1 deletion admin/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"./precache-manifest.435bc6ed659653c95c4cc7f3f6321d03.js"
"./precache-manifest.d83f2371a2d3f7e50560790a815198bd.js"
);

self.addEventListener('message', (event) => {
Expand Down
3 changes: 3 additions & 0 deletions admin/static/js/2.7adffe7b.chunk.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions admin/static/js/2.cafef96c.chunk.js

This file was deleted.

2 changes: 2 additions & 0 deletions admin/static/js/main.8c72441e.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/static/js/main.8c72441e.chunk.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions admin/static/js/main.b344d9cb.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion admin/static/js/main.b344d9cb.chunk.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion admin/tab.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="shortcut icon" href="./favicon.ico"/><link rel="stylesheet" href="./style.css"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><script type="text/javascript" src="./../../lib/js/socket.io.js"></script><title>Scenes [ioBroker]</title><link href="./static/css/2.9ba4c952.chunk.css" rel="stylesheet"><link href="./static/css/main.d4bed9c6.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,l,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)l=a[p],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),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=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(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,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var a=this["webpackJsonpscenes-react"]=this["webpackJsonpscenes-react"]||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=c;t()}([])</script><script src="./static/js/2.cafef96c.chunk.js"></script><script src="./static/js/main.b344d9cb.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./favicon.ico"/><link rel="stylesheet" href="./style.css"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><script type="text/javascript" src="./../../lib/js/socket.io.js"></script><title>Scenes [ioBroker]</title><link href="./static/css/2.9ba4c952.chunk.css" rel="stylesheet"><link href="./static/css/main.d4bed9c6.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,l,a=r[0],c=r[1],f=r[2],p=0,s=[];p<a.length;p++)l=a[p],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),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=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(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,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var a=this["webpackJsonpscenes-react"]=this["webpackJsonpscenes-react"]||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var f=0;f<a.length;f++)r(a[f]);var i=c;t()}([])</script><script src="./static/js/2.7adffe7b.chunk.js"></script><script src="./static/js/main.8c72441e.chunk.js"></script></body></html>
14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "scenes",
"version": "2.0.9",
"version": "2.0.10",
"news": {
"2.0.10": {
"en": "Added \"Do not overwrite state if it has the required value\" option",
"de": "Option \"Status nicht überschreiben, wenn er den erforderlichen Wert hat\" hinzugefügt",
"ru": "Добавлена опция «Не перезаписывать состояние, если оно имеет требуемое значение»",
"pt": "Adicionada a opção \"Não substituir o estado se ele tiver o valor necessário\"",
"nl": "\"Overschrijf status niet als het de vereiste waarde heeft\" optie toegevoegd",
"fr": "Ajout de l'option \"Ne pas écraser l'état s'il a la valeur requise\"",
"it": "Aggiunta l'opzione \"Non sovrascrivere lo stato se ha il valore richiesto\"",
"es": "Se agregó la opción \"No sobrescribir estado si tiene el valor requerido\"",
"pl": "Dodano opcję „Nie zastępuj stanu, jeśli ma wymaganą wartość”",
"zh-cn": "添加了“如果具有必需的值,请勿覆盖状态”选项"
},
"2.0.9": {
"en": "The colors are corrected",
"de": "Die Farben werden korrigiert",
Expand Down
40 changes: 25 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,18 @@ function activateSceneState(sceneId, state, isTrue) {
// Start timeout
const timer = setTimeout((id, setValue, _tIndex) => {
adapter.log.debug('Set delayed state for "' + sceneId + '": ' + id + ' = ' + setValue);
// execute timeout
adapter.getForeignState(id, (err, state) => {
// Set new state only if differ from desired state
if (!state || state.val !== setValue) {
adapter.setForeignState(id, setValue);
}
});

// execute timeout
if (stateObj.doNotOverwrite) {
adapter.getForeignState(id, (err, state) => {
// Set new state only if differ from desired state
if (!state || state.val !== setValue) {
adapter.setForeignState(id, setValue);
}
});
} else {
adapter.setForeignState(id, setValue);
}

if (timers[id]) {
// remove timer from the list
Expand All @@ -497,13 +501,17 @@ function activateSceneState(sceneId, state, isTrue) {
}
timers[stateObj.id] = [];
}
// execute timeout
adapter.getForeignState(stateObj.id, (err, state) => {
// Set new state only if differ from desired state
if (!state || state.val !== desiredValue) {
adapter.setForeignState(stateObj.id, desiredValue);
}
});
// Set desired state
if (stateObj.doNotOverwrite) {
adapter.getForeignState(stateObj.id, (err, state) => {
// Set new state only if differ from desired state
if (!state || state.val !== desiredValue) {
adapter.setForeignState(stateObj.id, desiredValue);
}
});
} else {
adapter.setForeignState(stateObj.id, desiredValue);
}
}
}

Expand Down Expand Up @@ -573,7 +581,9 @@ function getState(sceneId, stateNumber, callback) {
const stateId = scenes[sceneId].native.members[stateNumber].id;
adapter.getForeignState(stateId, (err, state) => {
// possible scene was renamed
if (!scenes[sceneId]) return;
if (!scenes[sceneId]) {
return;
}

scenes[sceneId].native.members[stateNumber].actual = state ? state.val : null;
// If processing finshed
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": "iobroker.scenes",
"version": "2.0.9",
"version": "2.0.10",
"description": "Scenes for ioBroker.",
"author": {
"name": "bluefox",
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scenes-react",
"version": "2.0.9",
"version": "2.0.10",
"private": true,
"dependencies": {
"@iobroker/adapter-react": "^1.0.5",
Expand Down
Loading

0 comments on commit 0666b57

Please sign in to comment.