Help with a zwave sendHubCommand

I can use the Basic Zwave Tool to toggle this parameter on and off but I just can't get the groovy code to do it!

How close am I?? I'm not getting any errors but it's not changing the parameter either.

The value can be either 0 (off) or 1 (on).

sendHubCommand(new hubitat.device.HubAction(zwave.configurationV1.configurationSet(parameterNumber: 15, size: 1, configurationValue: [0]).format()))


Edit: forgot to mention this is a S2 device! Ring Alarm Keypad G2 :wink:

That driver has a convenient method to handle hub commands..

sendToDevice(new hubitat.zwave.commands.configurationv1.ConfigurationSet(parameterNumber: 15, size: 1, scaledConfigurationValue: 0).format())

That works. Thank you very much!

1 Like

but if you want to use sendHubCommand directly:

sendHubCommand(new hubitat.device.HubAction(zwaveSecureEncap(new hubitat.zwave.commands.configurationv1.ConfigurationSet(parameterNumber:15, size:1, scaledConfigurationValue: 0).format()), hubitat.device.Protocol.ZWAVE))

But all that madness is why I created the sendToDevice methods in my drivers..

void sendToDevice(List<String> cmds, Long delay = 300) {
    sendHubCommand(new hubitat.device.HubMultiAction(commands(cmds, delay), hubitat.device.Protocol.ZWAVE))

void sendToDevice(String cmd, Long delay = 300) {
    sendHubCommand(new hubitat.device.HubAction(zwaveSecureEncap(cmd), hubitat.device.Protocol.ZWAVE))

List<String> commands(List<String> cmds, Long delay = 300) {
    return delayBetween(cmds.collect { zwaveSecureEncap(it) }, delay)
1 Like

Thanks, was just trying to figure out the command structure. I've been reading your Zwave Driver Guide but was really lost. :wink:


To add to the above, don't forget that if a "formatted" Z-Wave command or a list of such is returned as the value from a Groovy method that is also declared as a driver command (whether a custom command or one contracted by way of a Capability), it will automatically get sent when the method returns. Then you don't need to do it "manually" via either method above. But, again, this only works for commands (Z-Wave or Zigbee, BTW)...and since it's not consistent, some people prefer the "maual" sending like the above. :slight_smile:

(This tripped me up when I was new to Z-Wave drivers and wondered why my code that looked nearly the same as examples I saw didn't work...)