How do I set parameters in Home Assistant from MSR
-
Good morning,
I've finally migrated all my devices and logic over from my old Vera Plus to Home Assistant. The only remaining logic I had was a parameter lua call that I used in Vera to set the LED light on some Z-wave switches and outlets to off when it was bed time. I can set them in Home Assistant directly under the device tab, but I don't see how to do it through MSR. Can someone tell me how to do this?I'm running the latests MSR (22293) and I'm running Home Assistant 2022.10.4, 9.2 HA OS.
-
Not showing your work here, and missing detail available and needed. It would be useful to know what the device(s) is/are, and what you know about those devices/how the LEDs are manipulated, and you should show what you are doing in HA (screen shot service calls or similar work you've done there to make it happen).
-
@toggledbits said in How do I set parameters in Home Assistant from MSR:
Not showing your work here, and missing detail available and needed. It would be useful to know what the device(s) is/are, and what you know about those devices/how the LEDs are manipulated, and you should show what you are doing in HA (screen shot service calls or similar work you've done there to make it happen).
Patrick,
These are GE Enbrighten Z-wave devices. In Vera, I would run a lua command:luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='48',Data='112 4 3 1 2'},1)luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='49',Data='112 4 3 1 2'},1)luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='70',Data='112 4 3 1 2'},1)return true
In Home Assistant, I can manually change the parameter.
Like I said, I want to be able to turn it to "Always Off" in this case, when it's night time and we're asleep. When it's day time again, I want to change i back to "On when load is off"
In MSR, I do not see any sort of parameter setting for the same device.
-
toggledbitsreplied to tamorgen on Oct 25, 2022, 1:38 PM last edited by toggledbits Oct 25, 2022, 9:44 AM
@tamorgen Home Assistant's API is a little thin on publishing device information, sadly. While that has been getting better, it's still not good enough for Reactor to know, for example, that your switch is a Z-Wave device (crazy, right?). So, you get to provide that intelligence, at least until some day they expose the integration used for a device through their API. What information Reactor does get can be used to map some basic services, which is why you see
power_switch.on
,toggle.toggle
, etc., available in the menu, but since HA hasn't/can't tell us it's a ZWaveJS device, Reactor can't do much more there.But, that doesn't mean you can't get it done. Everything in Home Assistant is driven by services. Each integration defines what services it has, and although Reactor can't know what integrations are being used, if you do, you can find the service to use. Reactor has a generic
call_service
action on HassController system devices that allows you to call any service in Home Assistant for just this purpose. Although it's not as user-friendly as using something likepower_switch.on
, it's very powerful and gets you to almost everything Home Assistant can do.For ZWaveJS, there's a
zwave_js.set_config_parameter
service that you can call to tell the ZWaveJS integration in Home Assistant to set a configuration parameter value on a device. This is documented in Home Assistants documentation for the ZWaveJS component/integration. The required data for the service is pretty straightforward, and pretty much what you'd expect: the (Hass) entity ID, the parameter number, and the new value. I don't have your GE switches on my Hass mesh, but here's a call to a device I do have to set parameter 172 to 300:The
x_hass_system.call_service
action is found on your HassController's system entity in Reactor. From there, you just enter the service name, and format the data as JSON. I recommend using jsonlint.com to make sure you've got the data formed correctly. In your case, you would of course be setting parameter 3, and your entity ID would beswitch.master_be...
(I can't see the full ID because the menu is covering it in your screen shot). Remember that this has to be the Hass entity ID, not the Reactor entity ID (they are similar, but Hass has a dot after the first word, and Reactor uses underscore -- you want the dot version here).The
reactor.log
file will log this action and error that comes back from Hass, so be sure to look at that.FYI, I am working on a tighter integration between HassController and the UI to make
call_service
a bit more user-friendly (i.e. not require JSON for the data), but this is still a few weeks off at best. And that won't change the fact that their API doesn't give me a complete list of services a device supports, or what integration it's based on, so you are still going to have to provide that knowledge. -
@toggledbits said in How do I set parameters in Home Assistant from MSR:
@tamorgen Home Assistant's API is a little thin on publishing device information, sadly. While that has been getting better, it's still not good enough for Reactor to know, for example, that your switch is a Z-Wave device (crazy, right?). So, you get to provide that intelligence, at least until some day they expose the integration used for a device through their API. What information Reactor does get can be used to map some basic services, which is why you see
power_switch.on
,toggle.toggle
, etc., available in the menu, but since HA hasn't/can't tell us it's a ZWaveJS device, Reactor can't do much more there.But, that doesn't mean you can't get it done. Everything in Home Assistant is driven by services. Each integration defines what services it has, and although Reactor can't know what integrations are being used, if you do, you can find the service to use. Reactor has a generic
call_service
action on HassController system devices that allows you to call any service in Home Assistant for just this purpose. Although it's not as user-friendly as using something likepower_switch.on
, it's very powerful and gets you to almost everything Home Assistant can do.For ZWaveJS, there's a
zwave_js.set_config_parameter
service that you can call to tell the ZWaveJS integration in Home Assistant to set a configuration parameter value on a device. This is documented in Home Assistants documentation for the ZWaveJS component/integration. The required data for the service is pretty straightforward, and pretty much what you'd expect: the (Hass) entity ID, the parameter number, and the new value. I don't have your GE switches on my Hass mesh, but here's a call to a device I do have to set parameter 172 to 300:The
x_hass_system.call_service
action is found on your HassController's system entity in Reactor. From there, you just enter the service name, and format the data as JSON. I recommend using jsonlint.com to make sure you've got the data formed correctly. In your case, you would of course be setting parameter 3, and your entity ID would beswitch.master_be...
(I can't see the full ID because the menu is covering it in your screen shot). Remember that this has to be the Hass entity ID, not the Reactor entity ID (they are similar, but Hass has a dot after the first word, and Reactor uses underscore -- you want the dot version here).The
reactor.log
file will log this action and error that comes back from Hass, so be sure to look at that.Thanks for your detailed explanation Patrick. It makes sense. I'll play with that today and see if I can get it to function.
-
Patrick,
The basic command worked as you said.I have a single paramater working.
{ "parameter": 3, "value": 2, "entity_id": "switch.master_bedroom_jen_s_nightstand" }
One step further.... Is there a way to do multiple devices in a single call_service, or will I need entries for each?
-
Entries for each.
-
tamorgenreplied to toggledbits on Oct 25, 2022, 2:56 PM last edited by tamorgen Oct 25, 2022, 10:58 AM
@toggledbits , that's what I thought and did. Just wanted to make sure I wasn't making too many entries when one would do in some sort of json format.
Formatting it wasn't all that different than figuring out how to do it through lua on Vera. My wife will be glad not to be staring at a blue light when she's trying to get to sleep again.
Thanks for your help.
-
Well, now that you mention it, if the
data
passed to Hass will accept an array of entity IDs, I see no reason not to do it. It just passes it through. Have to get the JSON right, though. -
T toggledbits locked this topic on Jun 12, 2023, 10:02 PM
1/9