zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

[Help]: Kwikset 910 Lock - Cannot figure out how to send lock, unlock #224

Closed nospam2k closed 2 years ago

nospam2k commented 2 years ago

How can we help?

Trying to work out how to send door lock command. I've successfully setup the ZWave Controller with network key and I get back messages from the lock. I've been able to isolate lock and unlock messages (from manual locking, unlocking the door) using NOTIFICATION and eventLabel (if there is a better way to verify lock/unlock please let me know).

My problem is trying to send unlock, lock commands. I've tried the following inputting into the ZWave Controller:

I was using openzwave node with this code and it was working:

msg.payload = {"nodeid" : node_id, "cmdclass" : 98,
      "value" : (msg.payload === 'LOCK' ? true : false)}
  msg.topic = "setValue";

Here's what I've tried to translate into zwave-js

msg.payload = {'mode': 'ValueAPI', 'node': node_id, 'method': 'setValue', 'params': [{'cmdclass' : 98}, msg.payload === 'LOCK']}

and something I tried from a Yale lock issue I found here

 msg.payload = {
    node: 2,
    class: "Unmanaged",
    operation: "SetValue",
    params: [{ commandClass: 98, endpoint: 0, property: "targetMode" }, msg.payload === 'LOCK']
  }

The command seems to go through but there is no debug output coming from the ZWave Controller node.

Thanks for the help!

Version

latest npm

Node-RED Version

2.2

What hardware are you using?

Raspberry Pi

Any code to add?

No response

marcus-j-davies commented 2 years ago

You seem to be using an extremely old version of the Module, but the below should work.

 msg.payload = {
    node: 2,
    class: "Unmanaged",
    operation: "SetValue",
    params: [{ commandClass: 98, endpoint: 0, property: "targetMode" }, 0xff]
  }
Unsecured = 0x00,
UnsecuredWithTimeout = 0x01,
InsideUnsecured = 0x10,
InsideUnsecuredWithTimeout = 0x11,
OutsideUnsecured = 0x20,
OutsideUnsecuredWithTimeout = 0x21,
Unknown = 0xfe,
Secured = 0xff
nospam2k commented 2 years ago

I took that, as I said from an issue, which is an old issue reported here. What is the correct way to do it for the current release?

I thought that changing to 0xff would do it but still the same; nothing happens on the lock and no msg out the ZWave Controller node.

marcus-j-davies commented 2 years ago

So are you using the latest version?

nospam2k commented 2 years ago

I installed it from the pallet manager (raspberry pi w/node red 2.2);

marcus-j-davies commented 2 years ago

Cool!

send this to the controller node. (new message format)

let Message = {
    "payload": {
        "mode": "ValueAPI",
        "node": 2,
        "method": "setValue",
        "params": [{ commandClass: 98, endpoint: 0, property: "targetMode" }, 0xff]
    }
}
return Message
marcus-j-davies commented 2 years ago

See here.

https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Value-API

nospam2k commented 2 years ago

That's it! perfect. Thanks for such a great node and great help!!!

marcus-j-davies commented 2 years ago

Any time