Ok, Zwave_JS has multicast, now how do I use it?

I just wanna turn on 8 lights (connected to inovelli red series switches) at the same time. I read through the integration here (Z-Wave JS - Home Assistant), but all the command_class, property_key, etc stuff confused me.

2 Likes

I can relate to the confusion: I don’t know all of the technical details of Z-Wave, but I was excited about trying the multicast capability, too.

Are you using zwavejs2mqtt? I’m just using it for the control panel, and that was the key to figuring out the various parameters for me.

I’m basing the following example on one of my multicast automations for Z-Wave shades, but they use a multilevel switch command like the Inovelli Reds, so it should be similar.

For your lights, here’s an example of setting all 8 lights to 75% brightness (assuming you’re putting it in a script). Just replace the dummy entity names with the ones you want to control.

sequence:
  - service: zwave_js.multicast_set_value
    target:
      entity_id:
        - light.inovelli_1
        - light.inovelli_2
        ...
        - light.inovelli_8
    data:
      command_class: '38'
      property: targetValue
      value: 75

Here’s how I figured that out from the zwavejs2mqtt web UI: when you click on a node in the Control Panel view, you’ll get a listing of all kinds of info.

Scroll down to the Values section and you’ll see sections for all of the different command classes (Multilevel Switch, Configuration, etc.).

In this case, we want the Multilevel Switch, so you’ll click on that to get the following options:

In this example, we want to set targetValue to 75. Looking at the entry box for “Target value”, check out the values in square brackets. The first number is the node ID (varies depending on your system), the second is the Command Class (38 for Multilevel Switch), and the last one is the property ID (targetValue). I’ve also seen numeric values for property ID. I’ll leave it to the Z-Wave gurus to explain that difference, because I don’t know. :laughing: (My guess is that it has something to do with not allowing spaces in text-based property IDs? Probably totally wrong…)

Anyway, I hope that helps. Z-Wave experts, please chime in to correct any mistakes I’ve made!

4 Likes

I used the panel UI as described above, then did a manual action on one device and scanned the zwave logs to check it’s what I expected. To implement I put the multicast into a script so I can use it from multiple actions and write it once. Here’s what the script looks like for me, I call this from multiple automations:

2 Likes

@jdntx thank you, that really helped. After doing it that way, I was then able to work backwards to get it to work in node red (my preferred way to write automations). Couple example of the code below to help other node red’ers.

Heres my test nodes:
image

Heres the code to help you look at details of how those nodes are configured:

[{"id":"5175a9e.ec7de58","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"1062363b.9e675a","type":"api-call-service","z":"5175a9e.ec7de58","name":"Turn certain lights on","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"zwave_js","service":"multicast_set_value","entityId":"light.kitchen_island, light.kitchen_overhead, light.kitchen_sink, light.kitchen_table_master, light.living_room_overhead","data":"{\"command_class\":\"38\",\"property\":\"targetValue\",\"value\":99}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":434,"y":171,"wires":[[]]},{"id":"70e748cb.b37658","type":"api-call-service","z":"5175a9e.ec7de58","name":"Turn certain lights off","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"zwave_js","service":"multicast_set_value","entityId":"light.kitchen_island, light.kitchen_overhead, light.kitchen_sink, light.kitchen_table_master, light.living_room_overhead","data":"{\"command_class\":\"38\",\"property\":\"targetValue\",\"value\":0}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":434,"y":225,"wires":[[]]},{"id":"5697866c.cef9f8","type":"api-call-service","z":"5175a9e.ec7de58","name":"Turn all lights on (broadcast)","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"zwave_js","service":"multicast_set_value","entityId":"","data":"{\"command_class\":\"38\",\"property\":\"targetValue\",\"value\":99,\"broadcast\":\"true\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":454,"y":297,"wires":[[]]},{"id":"d47a69e4.40ee68","type":"api-call-service","z":"5175a9e.ec7de58","name":"Turn all lights off (broadcast)","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"zwave_js","service":"multicast_set_value","entityId":"","data":"{\"command_class\":\"38\",\"property\":\"targetValue\",\"value\":0,\"broadcast\":\"true\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":454,"y":351,"wires":[[]]},{"id":"b20d4e8a.68f2e","type":"inject","z":"5175a9e.ec7de58","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":205,"y":171,"wires":[["1062363b.9e675a"]]},{"id":"36ea8de.cfb7472","type":"inject","z":"5175a9e.ec7de58","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":205,"y":225,"wires":[["70e748cb.b37658"]]},{"id":"e4c9c0ab.7032d","type":"inject","z":"5175a9e.ec7de58","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":205,"y":297,"wires":[["5697866c.cef9f8"]]},{"id":"fd562835.e51128","type":"inject","z":"5175a9e.ec7de58","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":205,"y":351,"wires":[["d47a69e4.40ee68"]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHomeRpi","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
3 Likes

Awesome, glad it helped! I’m a Node-RED guy too, so it sounds like we had similar paths to our solutions. :grin::+1:

Did you notice a broadcast seems better than multicast?

If I turn ALL lights on in the house (roughly 25 inovelli switches), I get much faster response than if I do a selective multicast with just 4 lights.

Haven’t had the nerve to try a broadcast yet, but that’s interesting that it’s faster. Are those Inovellis the only devices on your Z-Wave network? I think my house would go bonkers if I tried that. :laughing:

Yah broadcast acted as if I was just turning one light on, yet they ALL came on at same time. With multicast, I still had slight chain reaction of lights turning on.

Mostly inovellis;
4 dome leak sensors
Econet water valve
Zooz light switch
Zooz 4-in-1
(2) Inovelli 4-in-1
(3) Honeywell smart outlets

This post helped me out immensely. Thank you for all explanations and screenshots! Works like a charm.

However… now that I have figured out how to broadcast the up and down commands for some blinds (using multi level command)… now I’d also love to send a “STOP!” command. In the Hass UI you have a Stop button. But what command is it sending? I can’t find any suitable value/button in zwavejs2mqtt UI that I can click on to trigger the stop, so therefor I can’t figure out what equivalent command to multicast.

Any ideas?

No idea, sorry. I dont have any automatic blinds yet.

Depending on your device, there will be a multilevel switch cc value “Open”, “Up” or “On”. Set that value to false. It will issue a Stop Level Change command which stops the cover from moving.

Thanks for the suggestion, but I just can’t get the stop to work. Honestly I think there might be a bug here. Or something is not expecting the values I am giving it.
I have a couple of Qubino Flush Shutter DC (ZMNHOD).

This screenshot is a part of one of the devices in zwavejs2mqtt with the values I suspect are the ones I need to affect:

As you can see, there definitely are a couple of “Up” and “Down” controls with on/off switches.
And I can confirm that setting one of them to “Off” in the UI as the blinds are moving will stop them. You were totally right there. Good stuff. Now I just need to get Home Assistant to send that in a multicast.

I can do this:

  • Set the binary switch (command_class 37, property: targetValue) to true/false (goes way up and way down)
  • Set the multilevel switch (command_class 38, property: targetValue) to an integer (0-99) (goes to the set position)

Example:

service: zwave_js.multicast_set_value
target:
  entity_id:
    - switch.bedroom_blind_1
    - switch.bedroom_blind_2
    - switch.bedroom_blind_3
    - switch.bedroom_blind_4
data:
  command_class: 38
  endpoint: 0
  property: targetValue
  value: 0

But I can’t do this:

  • Set “false” as value to the multilevel switch “Up” or “Down” (command_class 38, property: “Up” / “Down”)

If I send this:

service: zwave_js.multicast_set_value
target:
  entity_id:
    - switch.bedroom_blind_1
    - switch.bedroom_blind_2
    - switch.bedroom_blind_3
    - switch.bedroom_blind_4

data:
  command_class: 38
  endpoint: 0
  property: Up
  value: false

Then I get this:

zwave_js_server.exceptions.FailedZWaveCommand: Z-Wave error 31: The node of a virtual endpoint cannot be accessed this way!

That message is distinctly different from if I had sent in an integer here or if I had sent anything to a unknown property (like “foo”). (All of those generate a:
zwave_js_server.exceptions.SetValueFailed: Unable to set value via multicast)

So it seems it definitely recognizes the property and it validates the input but then has a firm opinion that this is a bad idea. Same goes if I try to set them to true.

Oh: As I was proof reading this I realized that I maybe should have specified “cover.bedroom_blind_x” - not switch. But the other multilevel commands worked with the “switch” entities even if they maybe should not have. I guess Home Assistant doesn’t care and just looks up the parent zwave devices. So does not seem to make a difference here: Can’t set Up or Down to neither true or false. (Tried with cover as well. No luck.)

Any obvious mistake I’m making here? Bug?

Can you provide the full stack trace? It would be in the zwavejs2mqtt logfile/console.

Yes, you suspect correctly. The entity IDs are only used to lookup the destination zwave network (you could have more than one) and the node IDs to set as part of the multicast command. It is confusing if you look at the entity domain and the CCs. You can use device ID (pick the device in the UI and convert to yaml) if that’s less confusing.

Interesting. I wasn’t seeing any error in the zwavejs2mqtt log file. But they do appear in the console!
Here you go:

2021-07-20 02:12:14.043 ERROR ZWAVE-SERVER: Z-Wave error The node of a virtual endpoint cannot be accessed this way!
ZWaveError: The node of a virtual endpoint cannot be accessed this way!
at VirtualNode.getNodeUnsafe (/usr/src/app/node_modules/zwave-js/src/lib/node/VirtualEndpoint.ts:203:9)
at MultilevelSwitchCCAPI.stopLevelChange (/usr/src/app/node_modules/zwave-js/src/lib/commandclass/MultilevelSwitchCC.ts:250:30)
at Proxy.MultilevelSwitchCCAPI.<computed> (/usr/src/app/node_modules/zwave-js/src/lib/commandclass/MultilevelSwitchCC.ts:420:16)
at VirtualNode.setValue (/usr/src/app/node_modules/zwave-js/src/lib/node/VirtualNode.ts:47:14)
at Function.handle (/usr/src/app/node_modules/@zwave-js/server/dist/lib/multicast_group/message_handler.js:12:51)
at Object.multicast_group (/usr/src/app/node_modules/@zwave-js/server/dist/lib/server.js:38:112)
at Client.receiveMessage (/usr/src/app/node_modules/@zwave-js/server/dist/lib/server.js:91:99)
at WebSocket.<anonymous> (/usr/src/app/node_modules/@zwave-js/server/dist/lib/server.js:44:45)
at WebSocket.emit (node:events:394:28)
at WebSocket.emit (node:domain:470:12)

The driver code does not allow multicast for the Start and Stop Level Commands. Either this is not supported by the z-wave specification (which would surprise me) or it’s a bug/unimplemented functionality. You could submit a bug report, or ask the question first directly to the developer in the node-zwave-js project.

1 Like

Good idea. The weird thing is this does not seem to be an issue in the zwavejs2mqtt web UI. One would think it would suffer from the same limitations if that was the case. Right?

1 Like

Will have another go in the morning to confirm what is going on in the web UI first. (My wife doesn’t approve of me debugging the blinds in the bedroom in the middle of the night for some reason.)
Thanks for all your help!

How are you using multicast in the web UI?

Doh! Spot on again. That obviously was not multicast. So indeed, very likely a driver issue for the multicast scenario, it seems.

I created a question/discussion, as per your suggestion, in the zwave forum. Can be found here.

1 Like