Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jun 14, 2020
1 parent b2c8433 commit f418ba7
Show file tree
Hide file tree
Showing 30 changed files with 350 additions and 203 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ sendTo(
The adapter will read all actual values for IDs defined in this scene and save it as configured ones.

## Changelog
### 2.0.1 (2019-06-13)
### 2.0.3 (2019-06-14)
* (bluefox) New GUI based on react

### 1.1.1 (2019-05-26)
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.7e2a3f00.chunk.js",
"main.js.map": "./static/js/main.7e2a3f00.chunk.js.map",
"main.js": "./static/js/main.7856b570.chunk.js",
"main.js.map": "./static/js/main.7856b570.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.81b5e61b.chunk.js": "./static/js/2.81b5e61b.chunk.js",
"static/js/2.81b5e61b.chunk.js.map": "./static/js/2.81b5e61b.chunk.js.map",
"static/js/2.93d14590.chunk.js": "./static/js/2.93d14590.chunk.js",
"static/js/2.93d14590.chunk.js.map": "./static/js/2.93d14590.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.ca572777f78efc82209ab7d733124f20.js": "./precache-manifest.ca572777f78efc82209ab7d733124f20.js",
"precache-manifest.c6c8bf62b550e55b7376395f0847bfc4.js": "./precache-manifest.c6c8bf62b550e55b7376395f0847bfc4.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.81b5e61b.chunk.js.LICENSE.txt": "./static/js/2.81b5e61b.chunk.js.LICENSE.txt"
"static/js/2.93d14590.chunk.js.LICENSE.txt": "./static/js/2.93d14590.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.8cdd9b0f.js",
"static/css/2.9ba4c952.chunk.css",
"static/js/2.81b5e61b.chunk.js",
"static/js/2.93d14590.chunk.js",
"static/css/main.d4bed9c6.chunk.css",
"static/js/main.7e2a3f00.chunk.js"
"static/js/main.7856b570.chunk.js"
]
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "3eb7bfda5385ab26bd6074a01edb3b14",
"revision": "2e10806b5b087848f5018290c502dab2",
"url": "./index.html"
},
{
"revision": "677ef5db4a3e0b5f72ea",
"revision": "10a51f26027ca8c09d8b",
"url": "./static/css/2.9ba4c952.chunk.css"
},
{
"revision": "fc9a26acf126e52fc60e",
"revision": "0f9b320e0f6b69e1f19a",
"url": "./static/css/main.d4bed9c6.chunk.css"
},
{
"revision": "677ef5db4a3e0b5f72ea",
"url": "./static/js/2.81b5e61b.chunk.js"
"revision": "10a51f26027ca8c09d8b",
"url": "./static/js/2.93d14590.chunk.js"
},
{
"revision": "eac4cf64bf573541fd6dba29c78393a0",
"url": "./static/js/2.81b5e61b.chunk.js.LICENSE.txt"
"url": "./static/js/2.93d14590.chunk.js.LICENSE.txt"
},
{
"revision": "fc9a26acf126e52fc60e",
"url": "./static/js/main.7e2a3f00.chunk.js"
"revision": "0f9b320e0f6b69e1f19a",
"url": "./static/js/main.7856b570.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.ca572777f78efc82209ab7d733124f20.js"
"./precache-manifest.c6c8bf62b550e55b7376395f0847bfc4.js"
);

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

This file was deleted.

1 change: 0 additions & 1 deletion admin/static/js/2.81b5e61b.chunk.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions admin/static/js/2.93d14590.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/static/js/2.93d14590.chunk.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/static/js/main.7856b570.chunk.js.map

Large diffs are not rendered by default.

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

This file was deleted.

1 change: 0 additions & 1 deletion admin/static/js/main.7e2a3f00.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.81b5e61b.chunk.js"></script><script src="./static/js/main.7e2a3f00.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.93d14590.chunk.js"></script><script src="./static/js/main.7856b570.chunk.js"></script></body></html>
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"common": {
"name": "scenes",
"version": "2.0.1",
"version": "2.0.3",
"news": {
"2.0.1": {
"2.0.3": {
"en": "New GUI based on react",
"de": "Neue GUI basierend auf react",
"ru": "Новый графический интерфейс, основанный на react",
Expand Down
104 changes: 54 additions & 50 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,104 +243,107 @@ let scenesTimeout = {};

// Check if actual states are exactly as desired in the scene
function checkScene(sceneId, stateId, state) {
if (checkTimers[sceneId]) {
for (let i = 0; i < scenes[sceneId].native.members.length; i++) {
// Do not check states with delay
if (scenes[sceneId].native.members[i].delay) continue;

// if state must be updated
if (stateId && scenes[sceneId].native.members[i].id === stateId) {
scenes[sceneId].native.members[i].actual = state.val;
}
for (let i = 0; i < scenes[sceneId].native.members.length; i++) {
// Do not check states with delay
if (scenes[sceneId].native.members[i].delay) {
continue;
}

return;
// if state must be updated
if (stateId && scenes[sceneId].native.members[i].id === stateId) {
scenes[sceneId].native.members[i].actual = state.val;
}
}

checkTimers[sceneId] = setTimeout(() => {
checkTimers[sceneId] = null;
checkTimers[sceneId] = checkTimers[sceneId] || setTimeout(_sceneId => {
checkTimers[_sceneId] = null;
let activeTrue = null;
let activeFalse = null;
let activeValue = null;
const isWithFalse = (scenes[sceneId].native.onFalse && scenes[sceneId].native.onFalse.enabled);
const sceneObj = scenes[_sceneId];
const sceneObjNative = sceneObj.native;
const isWithFalse = (scenes[_sceneId].native.onFalse && scenes[_sceneId].native.onFalse.enabled);

for (let i = 0; i < scenes[sceneId].native.members.length; i++) {
for (let i = 0; i < scenes[_sceneId].native.members.length; i++) {
// Do not check states with delay
if (scenes[sceneId].native.members[i].delay) continue;
if (scenes[_sceneId].native.members[i].delay) {
continue;
}

// There are some states
if (activeTrue === null) activeTrue = true;
if (activeFalse === null) activeFalse = true;

// if state must be updated
if (stateId && scenes[sceneId].native.members[i].id === stateId) {
scenes[sceneId].native.members[i].actual = state.val;
if (activeTrue === null) {
activeTrue = true;
}
if (activeFalse === null) {
activeFalse = true;
}

if (scenes[sceneId].native.virtualGroup) {
if (activeValue === 'uncertain') continue;
if (scenes[_sceneId].native.virtualGroup) {
if (activeValue === 'uncertain') {
continue;
}

if (activeValue === null) {
activeValue = scenes[sceneId].native.members[i].actual;
} else if (activeValue != scenes[sceneId].native.members[i].actual) {
activeValue = scenes[_sceneId].native.members[i].actual;
} else if (activeValue != scenes[_sceneId].native.members[i].actual) {
activeValue = 'uncertain';
}
} else {
if (scenes[sceneId].native.members[i].setIfTrue != scenes[sceneId].native.members[i].actual) {
if (scenes[_sceneId].native.members[i].setIfTrue != scenes[_sceneId].native.members[i].actual) {
activeTrue = false;
//if (!isWithFalse) break; -- state must be updated
}
if (isWithFalse && scenes[sceneId].native.members[i].setIfFalse != scenes[sceneId].native.members[i].actual) {
if (isWithFalse && scenes[_sceneId].native.members[i].setIfFalse != scenes[_sceneId].native.members[i].actual) {
activeFalse = false;
}
}
}

if (scenes[sceneId].native.virtualGroup) {
if (scenes[_sceneId].native.virtualGroup) {
if (activeValue !== null) {
if (scenes[sceneId].value.val !== activeValue || !scenes[sceneId].value.ack) {
scenes[sceneId].value.val = activeValue;
scenes[sceneId].value.ack = true;
if (scenes[_sceneId].value.val !== activeValue || !scenes[_sceneId].value.ack) {
scenes[_sceneId].value.val = activeValue;
scenes[_sceneId].value.ack = true;

adapter.setForeignState(sceneId, activeValue, true);
adapter.setForeignState(_sceneId, activeValue, true);
}
}
} else {
if (scenes[sceneId].native.onFalse && scenes[sceneId].native.onFalse.enabled) {
if (scenes[_sceneId].native.onFalse && scenes[_sceneId].native.onFalse.enabled) {
if (activeTrue) {
if (scenes[sceneId].value.val !== true || !scenes[sceneId].value.ack) {
scenes[sceneId].value.val = true;
scenes[sceneId].value.ack = true;
if (scenes[_sceneId].value.val !== true || !scenes[_sceneId].value.ack) {
scenes[_sceneId].value.val = true;
scenes[_sceneId].value.ack = true;

adapter.setForeignState(sceneId, true, true);
adapter.setForeignState(_sceneId, true, true);
}
} else if (activeFalse) {
if (scenes[sceneId].value.val !== false || !scenes[sceneId].value.ack) {
scenes[sceneId].value.val = false;
scenes[sceneId].value.ack = true;
if (scenes[_sceneId].value.val !== false || !scenes[_sceneId].value.ack) {
scenes[_sceneId].value.val = false;
scenes[_sceneId].value.ack = true;

adapter.setForeignState(sceneId, false, true);
adapter.setForeignState(_sceneId, false, true);
}
} else {
if (scenes[sceneId].value.val !== 'uncertain' || !scenes[sceneId].value.ack) {
scenes[sceneId].value.val = 'uncertain';
scenes[sceneId].value.ack = true;
if (scenes[_sceneId].value.val !== 'uncertain' || !scenes[_sceneId].value.ack) {
scenes[_sceneId].value.val = 'uncertain';
scenes[_sceneId].value.ack = true;

adapter.setForeignState(sceneId, 'uncertain', true);
adapter.setForeignState(_sceneId, 'uncertain', true);
}
}
} else {
if (activeTrue !== null) {
if (scenes[sceneId].value.val !== activeTrue || !scenes[sceneId].value.ack) {
scenes[sceneId].value.val = activeTrue;
scenes[sceneId].value.ack = true;
if (scenes[_sceneId].value.val !== activeTrue || !scenes[_sceneId].value.ack) {
scenes[_sceneId].value.val = activeTrue;
scenes[_sceneId].value.ack = true;

adapter.setForeignState(sceneId, activeTrue, true);
adapter.setForeignState(_sceneId, activeTrue, true);
}
}
}
}
}, 200);
}, 200, sceneId);
}

function checkTrigger(sceneId, stateId, state, isTrue) {
Expand Down Expand Up @@ -710,6 +713,7 @@ function main() {
for (let m = states[id].native.members.length - 1; m >= 0; m--) {
if (!scenes[id].native.members[m] || states[id].native.members[m].disabled) {
scenes[id].native.members.splice(m, 1);
continue;
}

// Reset actual state
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.1",
"version": "2.0.3",
"description": "Scenes for ioBroker.",
"author": {
"name": "bluefox",
Expand Down
4 changes: 3 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "scenes-react",
"version": "2.0.1",
"version": "2.0.3",
"private": true,
"dependencies": {
"@iobroker/adapter-react": "^1.0.2",
"@material-ui/core": "^4.10.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"react-beautiful-dnd": "^13.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.10.0",
Expand Down
Loading

0 comments on commit f418ba7

Please sign in to comment.