Zwave - sending cc commands directly to a node

I’m trying to send two command class commands directly to a node. I have ZWave.js UI installed, but did not setup MQTT. I see how to use the command class API through the developer services, so I think I have that part right for the first part of my configuration belw… Not sure how to get access to the associationsapi to set those direct (for this scene controller these two parameters have to be set at the same time to get it to work)

Here are the two I’m trying to send (I did convert the command_class to it’s correct ID) when trying above (Node 16 is my target node I’m trying to program):

{
        "mode": "CCAPI",
        "cc": "Scene Controller Configuration", #cc 45
        "method": "set",
        "node": 16, 
        "params": [1, 1] 
}
{
            mode: "AssociationsAPI",
            method: "addAssociations",
            params: [{nodeId:16},1,[{nodeId:1},{nodeId:82}]]
}

Any guidance would be appreciated.

Is there a reason you need to use an API for this? Both of those are settable in Z-Wave JS UI, using the UI part.

Unfortunately Eaton’s scene controller doesn’t work when setting groups/config through the UI, it only works if you can send it directly in back to back instruction sets. I have this working in my old Node-Red / Zwave.js setup just trying to migrate it over to HA.

You mean you have to set the associations and scene controller configuration commands at the same time? I was not sure if you meant that, or the association group targets.

As far as I understand it, yes. In Node-Red I send them as two back to back messages (I had to work with the developer of the Zwave.js nodes to get it to finally work there)

Here is how he helped me implement that through a Function node in Node-Red
image

A few more questions.

If you already did this in node-red, why do you need to do it again? The settings should stick even if you switched from node-red zwave-js to zwave-js-ui.

What is the purpose of adding the controller node in the associations command? Isn’t it already set when the node is included? Is it a requirement that all both target node and controller be set at the same time? Or are you just using this so you can also act on it via HA?

What is the purpose of the 250ms delay in that code? I’ve found the SmartThings handler and it uses 3.5 second delays between each Z-Wave command, which is quite a difference from 250ms.

Are you setting only one scene, or more than one?

If you are only setting one scene, 3.5 seconds sounds like it would be enough time to do this in the UI? Just have two browser windows open, one setting the scene conf and the other the associations. Then apply them back to back. Unless the association commands really need controller and target node at the same time, then that would be a problem since the UI only allows one at a time.

Is this something you need to do often for several nodes, or just once?

Do you need to do this from HA, or could you do it from ZUI using a driver function? The driver function lets you use the zwave-js API directly. Doing this from HA is about the same, but you cannot use the controller association API method, it has to be done with the CC method instead (which in this case is basically the same thing minus some error checking). With the driver function method you could save it as a snippet and run it in the future as needed, just by tweaking a few parameters.

1 Like

I find that occasionally for some reason the Scene Controller “forgets” the associations. So was future proofing my migration vs. keeping the old Node-Red as a backup.

It was to get the Scene button to send the scene on/off to the controller for event notification. Haven’t even crossed that bridge in HA yet.

I was looking at that as well and trying to remember. I set that function node up a couple of years ago.

Five scene buttons so have to go through it for each one

Just once every now and then when the scene controller quits working

That’s just what I was looking for, thanks!!! Now need to learn how to set it up right :wink:

That all said, I somehow got it to work (made the mistake of trying too many things in serial before testing - blame it on the messed up knee that makes it hard to go back and forth right now :wink: So not sure what I did that worked… Need to go back and see if I can remember/isolate everything I just did to see which one actually made it work

Thanks for all the help, now if I can’t cleanly replicate it I know about the driver function to take that approach

That looks like what is working, if I set the Group association first then immediately after configure the Group Level for that Association Group, it locks it in (I can do it in the same browser, just switching between the Group and Node configuration in the JSUI.

Thanks!!!