How to use 1 ZigBee device to control multiple channels?

I tried your code, but I’m getting an error in the Logs:

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: physicalgraph.device.HubAction(java.util.ArrayList)

How do I fix this?

Not sure… I am not a ST groovy expert… :wink:

Maybe try…

def childOn(dni) {
    def cmd = zigbee.on()
    sendHubCommand(cmd)
}

or even simply (note that this is different than your original code, ‘void’ → ‘def’, to allow a returned value)

def childOn(dni) {
    zigbee.on()
}

Thanks. It turns out that “sendHubCommand(cmd)” was the fix. It actually doesn’t matter about def or void.

I also have another question: When I try to use the below to check if all children are off before turning the parent off, it doesn’t work. How might I fix this?

void childOff(dni) {    
    if (!childDevices.any { it.currentValue("switch") == "on" }) {
	    sendEvent(name: "switch", value: "off")
        log.debug("all off")
    }

Found out that I actually have to put the if statement in the parse function - not childOff().

1 Like

So I’m now trying to set all children off when the parent is off. So the below code (in parent handler) sets the correct status for each child, but it doesn’t actually control the child’s “off()” function (in child handler). How can I actually control the child’s “off()” function?

childDevices.each {
	it.sendEvent(name: "switch", value: event.value)
}

I think you can just call

it.off()

2 Likes