ianakapilotlight wrote: ↑12 Jun 2021 18:16
Hello, I am having the same problem. Did you find a fix for this?
I
did, actually (and I meant to create a YouTube video showing how, but I moved on to the next shiny object)
First, look at Eric Maycock's post about the Qubino stuff
https://community.smartthings.com/t/rel ... mmer/79618, giving special attention to the qubino-flush-2-relays part
https://github.com/erocm123/SmartThings ... ays.groovy.
Near the bottom, he has a function called "createChildDevices" which gets called whenever the DTH gets installed or updated. It turns out that
your DTH can create/delete child devices. They appear as completely separate devices (so you can name them different things, set up different rules for each one, etc), but their communication with the hub go through your DTH.
The idea is that wave events that the hub receives will all get passed to your main DTH, and it's that DTH's responsibility to detect that it's a multi-channel command, figure out the channel, and notify the child device. It does
that by creating a zwave event with the child's network ID. The network ID's for the child devices are chosen at the time you create them with addChildDevice(...). What Eric did (and I copied) was to just put a suffix on the main device's DNI (since we know that's already unique, so different suffixes should also be unique). You see this in his code with "${device.deviceNetworkId}-ep${i}". I guess the "-ep" part is for "end-point".
So, you end up with device ID's like: "2C", "2C-ep2", "2C-ep3", etc. Note: I handled the first switch in my main DTH and the others in child switches (which is why the first switch's DNI doesn't have a suffix; it just has the DNI of the main DTH). I think Eric creates a child DNI for
all of his switches.
So, that's how you get events to your child devices (so that they properly update their on/off status). How do you get events from your child DTH to the hub? I guess you
could have them create zwave events by themselves, but it creates duplication of code. If you look at Eric's child-device code
https://github.com/erocm123/SmartThings ... ice.groovy, you'll see that he just has his on() and off() methods just call a method in the parent DTH with something like "parent.childOn(device.deviceNetworkId)". It's important that the DNI be passed along, since that's the only way the parent DTH will know which of the child devices needs to be turned on/off.
Although Eric wrote his own child-switch DTH, I think there's one that does the same thing built into the Smartthings IDE called "Child Switch" which does the same thing. That's the one I use. If you needed child devices of more-exotic stuff (like child RGBW bulbs, say), you might have to write your own child DTH like Eric did.
From there, your parent DTH gets these requests using the DNI you made (with suffixes) when you created the child devices. You need to turn these into a zwave channel, and you can see Eric do this in his "channelNumber(String $dni)" method. Once you have converted the child's DNI into the zwave channel, you can send the basicSet() zwave messages you see in his childOn() and childOff() methods.
If it helps you at all, here's the one I'm currently using:
https://gist.github.com/jemenake/a25eb1 ... 3f9c6bd538. It's a little more basic (it's a switch-only, uses the built-in "Child Switch" DTH, etc.) but it's probably easier to wrap your head around for a start.
Let me know if that helps, or if you need more explanation.