diff --git a/nodes/out.js b/nodes/out.js index 65f2eae..7229179 100644 --- a/nodes/out.js +++ b/nodes/out.js @@ -102,7 +102,7 @@ module.exports = function(RED) { switch (command) { case 'state': if (payload === 'toggle') { - if ('position' in device.current_values) { + if (device.current_values && 'position' in device.current_values) { payload = device.current_values.position > 0 ? 'close' : 'open'; } } @@ -119,7 +119,7 @@ module.exports = function(RED) { case 'lock': command = 'state'; if (payload === 'toggle') { - if ('lock_state' in + if (device.current_values && 'lock_state' in device.current_values && device.current_values.lock_state === 'locked') { payload = 'unlock'; } else { diff --git a/package.json b/package.json index c477535..d91a3a5 100755 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "name": "node-red-contrib-zigbee2mqtt", "description": "Zigbee2mqtt connectivity nodes for node-red", - "version": "2.6.5-a19", + "version": "2.7.1", "dependencies": { "eventsource": "^2.0.2", "mqtt": "^4.3.7",