syntex-automation
Advanced tools
Comparing version 1.2.1-b18 to 1.2.1-b19
{ | ||
"name": "syntex-automation", | ||
"version": "1.2.1-b18", | ||
"version": "1.2.1-b19", | ||
"description": "An automation system for your smart home", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -357,3 +357,3 @@ module.exports = class Automation | ||
var theRequest = { | ||
url : 'http://' + block.bridge + ':' + block.port + '/devices?id=' + block.id + '&type=' + this.TypeManager.letterToType(block.letters[0]) + '&counter=' + block.letters[1], | ||
url : 'http://' + block.bridge + ':' + block.port + '/devices?id=' + block.id + '&type=' + this.TypeManager.letterToType(block.letters[0]) + '&counter=' + block.letters.slice(1), | ||
timeout : 10000 | ||
@@ -520,3 +520,3 @@ }; | ||
var theRequest = { | ||
url : 'http://' + (block.bridge || '127.0.0.1') + ':' + (block.port || this.manager.RouteManager.getPort(block.plugin)) + '/devices?id=' + block.id + '&type=' + this.TypeManager.letterToType(block.letters[0]) + '&counter=' + block.letters[1], | ||
url : 'http://' + (block.bridge || '127.0.0.1') + ':' + (block.port || this.manager.RouteManager.getPort(block.plugin)) + '/devices?id=' + block.id + '&type=' + this.TypeManager.letterToType(block.letters[0]) + '&counter=' + block.slice(1), | ||
timeout : 10000 | ||
@@ -840,2 +840,28 @@ }; | ||
{ | ||
const checkCharacteristics = (result) => { | ||
if(result.state instanceof Object && result.block instanceof Object && result.block.characteristics instanceof Object) | ||
{ | ||
var characteristics = Object.keys(result.block.characteristics); | ||
for(const x in result.block.state) | ||
{ | ||
if(!characteristics.includes(x)) | ||
{ | ||
delete result.block.state[x]; | ||
} | ||
} | ||
for(const x in result.state) | ||
{ | ||
if(!characteristics.includes(x)) | ||
{ | ||
delete result.state[x]; | ||
} | ||
} | ||
} | ||
return result; | ||
}; | ||
return new Promise((resolve) => { | ||
@@ -851,3 +877,3 @@ | ||
resolve({ block, state }); | ||
resolve(checkCharacteristics({ block, state })); | ||
}); | ||
@@ -857,3 +883,3 @@ } | ||
{ | ||
resolve({ block, state }); | ||
resolve(checkCharacteristics({ block, state })); | ||
} | ||
@@ -867,5 +893,19 @@ } | ||
block.state = state; | ||
if(block.characteristics != null) | ||
{ | ||
block.state = {}; | ||
resolve({ block, state : comparison }); | ||
for(const x in block.characteristics) | ||
{ | ||
block.state[x] = state[x]; | ||
} | ||
resolve(checkCharacteristics({ block, state : comparison })); | ||
} | ||
else | ||
{ | ||
block.state = state; | ||
resolve(checkCharacteristics({ block, state : comparison })); | ||
} | ||
}); | ||
@@ -875,3 +915,3 @@ } | ||
{ | ||
this._getState(automation, block).then((state) => resolve({ block, state })); | ||
this._getState(automation, block).then((state) => resolve(checkCharacteristics({ block, state }))); | ||
} | ||
@@ -878,0 +918,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25969
787