Is there an example of a parent-child / component driver out there? Especially a zwave one, but would take whatever?
I've never made one of those, but have been thinking for a while that it may make sense to do this for the GE motion switch/dimmer devices as it is really 2 different things a switch/dimmer and a motion sensor.
As such I thought I would try to learn something new using a device I already know intimately well.
EDIT: Looks like there is something on the hubitat git. I'll start there...
I'm not even 100% sure this needs to be done at all for this device. But it seems like a good idea so I thought I would at least try it and see what it looks like.
OK, clearly I'm missing something simple. Any thoughts on what painfully obvious thing I am missing @mike.maxwell ?
If I do this off() function below from a command button in the parent driver it works fine.
However, when I do the off from the child dimmer device, I see the event making to to the componentOff(cd) function in the parent, and then to the off() function in the parent, but then nothing happens on the zwave device. Nada - no message, nothing in the log, nothing.
Do I need to move the zwave pieces into the child? I was just going to leave all the zwave stuff in the parent, but maybe that doesn't work that way.
void componentOff(cd){
if (logEnable) log.info "received off request from ${cd.displayName}"
getChildDevice(cd.deviceNetworkId).parse([[name:"switch", value:"off", descriptionText:"${cd.displayName} was turned off"]])
def test = off()
}
def off() {
if (logEnable) log.debug "Turn device OFF"
def cmds = []
cmds << zwave.basicV1.basicSet(value: 0x00).format()
cmds << zwave.switchMultilevelV2.switchMultilevelGet().format()
return delayBetween(cmds, 3000)
}