I’m trying to make a device that controls four relays (as basic switches). I’m setting it up as a parent device (controlling relay #1) and three child devices (controlling relays #2 - #4).
The parent device calls the on() and off() methods, and the returned list of zwave commands do get sent out to the device. For example:
// called from on()
def on1() {
log.debug "on1()"
delayBetween([
zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:1, parameter:[255]).format(),
zwave.multiChannelV3.multiChannelCmdEncap(sourceEndPoint:1, destinationEndPoint:1, commandClass:37, command:2).format()
], 1000)
}
However, on/off command sent from the children don’t get sent, even though they’re properly getting handed to the parent (and the parent is turning the dni to a channel number), the zwave commands do not get sent out:
def childOn(String id) {
log.debug("childOn($id)")
int channel = zwaveChannelFromChildDNI(id)
log.debug(" Looks like that's channel $channel")
// This does not get sent
delayBetween([
zwave.multiChannelV3.multiChannelCmdEncap(destinationEndPoint:channel, commandClass:37, command:1, parameter:[255]).format(),
zwave.multiChannelV3.multiChannelCmdEncap(destinationEndPoint:channel, commandClass:37, command:2).format()
], 1000)
}
The method does get executed and correctly determines the channel:
[fd539bbb-61ee-41c7-901c-271682a24ea5] 11:16:37 AM: debug Looks like that’s channel 4
[fd539bbb-61ee-41c7-901c-271682a24ea5] 11:16:37 AM: debug childOn(2A-ep4)
I was able to get something working by using code from someone else’s child-device example:
def childOn(String id) {
log.debug("childOn($id)")
int channel = zwaveChannelFromChildDNI(id)
log.debug(" Looks like that's channel $channel")
def cmds = []
// "command()" calls .format() (and possibly wraps in security encapsulation) on the command objects
// "encap()" wraps the command in a multi-channel encapsulation
cmds << new physicalgraph.device.HubAction(command(encap(zwave.basicV1.basicSet(value: 0xFF), channel)))
cmds << new physicalgraph.device.HubAction(command(encap(zwave.switchBinaryV1.switchBinaryGet(), channel)))
sendHubCommand(cmds)
}
But this doesn’t have a delay between messages, and I’d also just like to know why the childOn() doesn’t work, but on() does.
I’ve tried using “Switch Child Device” from “erocm123” and “Child Switch” from “smartthings” both giving the same effect. Anybody have any idea how we’re supposed to emit zwave commands from child devices?