Sending ZWave Configuration Commands with ZWaveJS2MQTT

If you are using ZWaveJS2MQTT to handle the other side of your ZWaveJS Integration, I found a decent workaround for the lack of ability to send Configuration Commands.

You can access the API via MQTT.

Publish to this topic:

{PREFIX}/_CLIENTS/ZWAVE_GATEWAY-{ANY_IDENTIFIER}/api/writeValue/set

Use a JSON encoded payload that looks like this:

{
        'args': [
            {
                'nodeId': 33,
                'commandClass': 112,
                'endPoint': 0,
                'property': 46
            },
            value_you_want_to_send
        ]
}

Hope this helps someone. It helped me to be able to keep my custom Climate automations and still use ZWaveJS.

1 Like

Thanks for this…
I thought I would add, at least in my case, that you can also use the ZWaveJS2MQTT GUI to do configurations. If you have the logs turned on, you can also see what the corresponding api call looks like.

yes! of course! I meant, if you wanted to send configuration commands from an automation or some script, this is the only way I’ve found to be able to do so.

Thanks! This was one of the last couple of pieces to complete my migration.

1 Like

Hi good afternoon,

I’m not able to get this working; some help will be really appreciated

This is my function in Node-RED:

var outputMsgs = [];

    outputMsgs.push( { 
        payload:{
            'args': [
            {
                'nodeId': 6,
                'commandClass': 112,
                'endPoint': 0,
                'property': 19
            },
            99
        ]
        } 
    } 
    );

return [ outputMsgs ];

And this is the topic in my MQTT node

zwavejs2mqtt//_CLIENTS/ZWAVE_GATEWAY-zwavejs2mqtt/api/writeValue/set

It is communicating with zwavejs2MQTT and these are the log entries when I send the message and when I change the parameter in zwavejs2MQTT itself

------------------ Node-RED -----------------------------
2021-02-24 18:25:22.558 INFO MQTT: Message received on zwavejs2mqtt//_CLIENTS/ZWAVE_GATEWAY-zwavejs2mqtt/api/writeValue/set, ‘{“args”:[{“nodeId”:6,“commandClass”:112,“endPoint”:0,“property”:19},99]}’

----------------- Zwavejs2MQTT ------------------------
2021-02-24 18:25:31.304 INFO ZWAVE: Calling api writeValue with args: [ { nodeId: 6, commandClass: 112, property: 19 }, 99, [length]: 2 ]
2021-02-24 18:25:31.304 INFO ZWAVE: Writing 99 to 6-112-0-19
2021-02-24 18:25:31.335 INFO ZWAVE: Success zwave api call writeValue { success: true, message: ‘Success zwave api call’, result: undefined }
2021-02-24 18:25:32.376 INFO ZWAVE: Node 6: value updated: 112-0-19 99 => 99

I just found the issue; I had two / in my MQTT node…

I got a Popp Strike Lock and the only way to use the auto-close function is a workaround with a config parameter. I need to set targetMode (red circle) to 1 for the lock to stay open for 4 seconds. The Plan is to map this command to a button, which is useable in the UI or use the command in further automations. The problem is with zwave_js.set_config_parameter youre only able to set the parameters in configuration (blue outline).

Is there no way without mqtt or node red to use the configuration call in an automation? Or is something like that planned for ZwaveJS2Mqtt?

Having some issues getting this to work.
So I ran the command in the configuration and this it what it looked like:
2021-03-12 14:11:37.354 INFO ZWAVE: Calling api writeValue with args: [
{ nodeId: 21, commandClass: 121, endpoint: 1, property: ‘toneId’ },
1,
[length]: 2
]
2021-03-12 14:11:37.363 INFO ZWAVE: Writing 1 to 21-121-1-toneId
2021-03-12 14:11:37.491 INFO ZWAVE: Success zwave api call writeValue { success: true, message: ‘Success zwave api call’, result: undefined }

Then I tried to recreate that in scripts and I put this in as the payload:
{args: [ { nodeId: 21, commandClass: 121, endpoint: 1, property: ‘toneId’ }, 1,[length]: 2 ]}
With this as the topic:
zwave/_CLIENTS/ZWAVE_GATEWAY-21/api/writeValue/set
And I get this as the log:

2021-03-12 14:23:27.526 INFO APP: GET /health/zwave 200 1.601 ms - 1875
2021-03-12 14:24:42.496 INFO MQTT: Message received on zwave/_CLIENTS/ZWAVE_GATEWAY-21/api/writeValue/set, “{args: [ { nodeId: 21, commandClass: 121, endpoint: 1, property: ‘toneId’ }, 1,[length]: 2 ]}”
2021-03-12 14:24:42.502 INFO ZWAVE: Calling api writeValue with args: [ [length]: 0 ]
2021-03-12 14:24:42.503 INFO ZWAVE: Cannot read property ‘nodeId’ of undefined writeValue {
success: false,
message: “Cannot read property ‘nodeId’ of undefined”
}

I’m certain it is a formatting error, but not sure what I am doing in correct in the formatting.

I’m not sure why but the trick for me was to remove the length part. Plus, you’ll need to put each key in quotes (I use double-quotes) and wrap the whole thing in another quote (single-quote) (and I also changed your toneId from single to double-quotes):
i.e.
'{args: [ { "nodeId": 21, "commandClass": 121, "endpoint": 1, "property": "toneId" }, 1 ] }'

The targetMode value (red circle) is set with the lock entity in HA. Use the lock.unlock service to unlock it.

1 Like

Thanks for your reply but unfortunately lock.unlock won’t work, alredy tried that. The Popp strikelock creates 2 lock entities:


The blue one is not useable and wont react on lock.unlock service.
The red one works but without automatic closing, lock.unlock => stays open forever, lock.lock => buzzer goes off again.

Right now, Im just using a script with lock.unlock, wait 5 seconds and then lock.lock (on the red marked entity). This works but the downside is, that this method is prone to connectivity issues. If the lock.lock command won’t be received from the lock, it will be buzzing forever. The strike lock is operating in my garden door and it is buzzing really loud, plus it is around 60 meters away from my house (front yard), which means that I will not hear it, but my neighbors will

just wanted to report back, that there is alredy a solution for the popp strikelock:

service: zwave_js.set_value
data:
  command_class: '98'
  property: targetMode
  value: 1
target:
  device_id: xxxxxx

You need to open the lock with this servicecall and autoOff is working as intended

@wmaker was close to the right format. at least for an automation in HA. The actual format needs to be…

Topic:
{PREFIX}/_CLIENTS/ZWAVE_GATEWAY-{ANY_IDENTIFIER}/api/writeValue/set
Payload:
{"args": [ { "nodeId": 16, "commandClass": 112, "endpoint": 0, "property": 16 }, 50268714 ] }

The above payload is found by using the notation from the configuration panel for the z-wave device. In this case that is…

  node commandClass endpoint property    value
 [ 16  -    112    -    0   -   16   ]  50268714

BTW the command above will set notification lighting for an Inovelli Red Series Switch. Value is created using the Inovelli Switch Toolbox.