Skip to content

Commit

Permalink
z2m-out Lock support
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypopov committed Jul 30, 2022
1 parent 86d2b02 commit 6e897b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nodes/out.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@
{'value':'color_temp', 'label':'Color Temperature (50..400)'},
{'value':'color_temp_move', 'label':'Color Temperature Move (50..400|stop)'},
{'value':'color_temp_step', 'label':'Color Temperature Step (50..400)'},
{'value':'position', 'label':'Position'},
{'value':'position', 'label':'Position (0..100)'},
{'value':'lock', 'label':'Lock (lock|unlock|on|off|toggle)'},
{'value':'alert', 'label':'Alert'}
]
},
Expand Down
15 changes: 15 additions & 0 deletions nodes/out.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ module.exports = function(RED) {
payload = parseInt(payload);
break;

case 'lock':
command = 'state';
if (payload === 'toggle') {
if ('state' in device.current_values && device.current_values.state === 'lock') {
payload = 'unlock';
} else {
payload = 'lock';
}
} else if (payload === 'lock' || payload == 1 || payload === true) {
payload = 'lock';
} else if (payload === 'unlock' || payload == 0 || payload === false) {
payload = 'unlock';
}
break;

case 'color':
payload = {"color":payload};
break;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"name": "node-red-contrib-zigbee2mqtt",
"description": "Zigbee2mqtt connectivity nodes for node-red",
"version": "2.5.2",
"version": "2.6.0",
"dependencies": {
"eventsource": "^2.0.2",
"mqtt": "^4.3.7",
Expand Down

0 comments on commit 6e897b4

Please sign in to comment.