node-red-contrib-deconz
Advanced tools
Comparing version 0.10.5 to 0.10.6
@@ -42,2 +42,3 @@ module.exports = function(RED) { | ||
node.status({}); //clean | ||
node.getState(deviceMeta); | ||
}, 1500); //update status with the same delay | ||
@@ -61,6 +62,7 @@ } | ||
sendState(device) { | ||
getState(device) { | ||
var node = this; | ||
if (device.state === undefined) { | ||
return; | ||
// console.log("CODE: #66"); | ||
@@ -89,12 +91,17 @@ // console.log(device); | ||
} | ||
if (node.oldState === undefined && device.state[node.config.state]) { node.oldState = device.state[node.config.state]; } | ||
if (node.prevUpdateTime === undefined && device.state['lastupdated']) { node.prevUpdateTime = device.state['lastupdated']; } | ||
return(device) | ||
} | ||
}; | ||
//outputs | ||
if ( node.config.state in device.state && node.config.output == 'onchange' && device.state[node.config.state] == node.oldState ) { | ||
return; | ||
} | ||
if ( node.config.state in device.state && node.config.output == 'onupdate' && device.state['lastupdated'] == node.prevUpdateTime ) { | ||
return; | ||
} | ||
node.oldState = device.state[node.config.state]; | ||
node.prevUpdateTime = device.state['lastupdated']; | ||
sendState(device) { | ||
var node = this; | ||
device = node.getState(device); | ||
if(!device) { return; } | ||
//outputs | ||
if ( !(node.config.state in device.state && node.config.output == 'onchange' && device.state[node.config.state] == node.oldState) && | ||
!(node.config.state in device.state && node.config.output == 'onupdate' && device.state['lastupdated'] == node.prevUpdateTime )) | ||
{ | ||
node.send([ | ||
@@ -108,2 +115,4 @@ { | ||
} | ||
node.oldState = device.state[node.config.state]; | ||
node.prevUpdateTime = device.state['lastupdated']; | ||
}; | ||
@@ -152,11 +161,11 @@ | ||
//https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-WXKG01LM | ||
// Event Button Action | ||
// 1000 One initial press | ||
// 1001 One single hold | ||
// 1002 One single short release | ||
// 1003 One single hold release | ||
// 1004 One double short press | ||
// 1005 One triple short press | ||
// 1006 One quad short press | ||
// 1010 One five+ short press | ||
// Event Button Action | ||
// 1000 One initial press | ||
// 1001 One single hold | ||
// 1002 One single short release | ||
// 1003 One single hold release | ||
// 1004 One double short press | ||
// 1005 One triple short press | ||
// 1006 One quad short press | ||
// 1010 One five+ short press | ||
if ([1002,2002,3002,4002,5002].indexOf(state['buttonevent']) >= 0) characteristic.ProgrammableSwitchEvent = 0; | ||
@@ -163,0 +172,0 @@ else if ([1004,2004,3004,4004,5004].indexOf(state['buttonevent']) >= 0) characteristic.ProgrammableSwitchEvent = 1; |
@@ -41,3 +41,3 @@ { | ||
}, | ||
"version": "0.10.5" | ||
"version": "0.10.6" | ||
} |
Sorry, the diff of this file is not supported yet
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
767918
2753