Suggestion to multi endpoint DTHs (Solution to only child switches being offline)

Multi endpoint DTHs, such as “zigbee multi switch”, uses parent & child system.

Let’s say, for 2 gang switch,
when parent dni(device network id) is A123,
child dni is named as A123:02

But in some situations, such as instability in zigbee network, parent device gets rejoined, and dni of the parent gets changed, let’s say to B456

However, in this situation, dni of the child device remains with old dni prefix, A123:02,
so this makes the problem of child device being offline.
Child dni should be changed to B456:02, when parent dni gets changed to B456.

I have heard from lots of people that are suffering from this problem in Korean Smartthings community, especially in “DAWOS DNS In-Wall Switch”, a Korean WWST product.
(Unlike in United States, where most wall switches are 1 gang switches, almost all wall switches in Korea are multi gang switches. cultural difference.)

So I suggest that it would be better to change child dni of the multi switch, when parent dni gets changed.
One solution would be adding following code to configure() function or updated() function in “zigbee-multi-switch.dth”


childDevices.each {
def childEndpoint = getChildEndpoint(it.deviceNetworkId)
if (it.deviceNetworkId != “$device.deviceNetworkId:$childEndpoint”) {
it.setDeviceNetworkId("$device.deviceNetworkId:$childEndpoint")
}
}


Thank you.

1 Like

I believe you’ll have to detect the change in the DNI and have the DTH change the DNI for the child devices. The platform does not make assumptions about child devices because some child devices have virtual DNI’s and may need a change even if the parent DNI changes.

1 Like

Yes. That is exactly what I am saying.

The additional code above for “zigbee-multi-switch” dth is doing that job in DTH level.

When rejoin happens, configure() function would be called, and when dni changes, updated() function would be called.

the code above is changing each of child device’s dni according to parent’s dni, when parent and child dni does not match.

So it would solve the problem if you put the code above in configure() or updated(), child dni problem will be solved.

FYI, DAWON in-wall switch is a wall switch that works without neutral wire. So it works as SLEEPY END DEVICE, which makes it more likely to be unstable than switches with neutral wire that work as zigbee ROUTERs.

Since I cannot change the built-in “zigbee-multi-switch” dth of the WWST product, which makes probem for lots of people using DAWON in-wall switch, I’m suggesting the solution to Smartthings team.

1 Like

This is good work, hopefully the SmartThings team will test this out and update the DTH

To Smartthings team.
Thank you very much for your immediate response.

1 Like

@tpmanley
Regarding the new changes in Zigbee Multi Switch,

There seems to be some problem, when creating child devices without leading zero, as you mentioned in github thread above.

addChildDevice(“Child Switch Health”, “{device.deviceNetworkId}:{i}”,…

If there’s no leading zero, there might be some problem in parse() method.
In parse method, eventDescMap?.sourceEndpoint and eventDescMap?.endpoint used to tell which endpoint is used, and these are texts with leading zero, such as “01”, “02”.
But if the child devices are created without leading zero,

		def childDevice = childDevices.find {
			it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.sourceEndpoint}" || it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.endpoint}"
		}

the code above, which finds childs devices with DNIs, might not work properly.

Please revise the source code, if needed.

And please consider that, devices already paired with this dth, have child device DNIs already created with leading zeros.

So if you consider to create the child devices DNIs without leading zero, then, there must be some consideration with already created child devices with leading zeros.

For now, because parse() function is written assuming leading zero, so, I don’t have any problem with my zigbee multi switch device for now, because my child switch devices are already created with leading zeros. But if I pair another device now, then child DNIs will be without leading zero, and this could make some problem.

Thank you.

Thanks for catching this. I’ll make sure it’s addressed.

2 Likes

Quick update.

I just finished deploying a hotfix of this change: https://github.com/SmartThingsCommunity/SmartThingsPublic/pull/38146

I also called updated() on all installed devices using this DTH. This should have both fixed any errors caused by the bad DTH deployed on Tuesday as well as fixed any existing devices that had not yet been fixed.

We appreciate you pointing out this mistake for us.

3 Likes

I’m having a similar problem with my 2 gangs Zigbee Switch module.
Child devise is appearing offline while main device in online.
I’m using "ZigBee Multi Switch” build in handler.
In addition to that I unable to control my module via the smartthings app. These are the parameters I’m getting:

Data:

  • application: 52
  • endpointId: 01
  • manufacturer: _TZE200_5apf3k9b
  • model: TS0601
  • onOff: catchall
  • zigbeeNodeType: ROUTER

Raw Description: 01 0104 0051 00 05 0000 000A 0004 0005 EF00 01 0019

@steven.green can you please suggest what to do ? Shall I use the hotfix you suggested ?
I’m not a programmer but understand how things works. Please advise…

@dotan_shai, how was the device added? Since that fingerprint isn’t in the handler you mentioned, I’m guessing it defaulted to another DTH and then you changed it later? That’s unlikely to work.

Even if you self-published a DTH with the fingerprints for your device added, it still might not work correctly because different devices represent and communicate with their endpoints differently. Unless your device is one of the officially supported devices on the DTH, I can’t say for certain that it will work.

Added as any Zigbee device. Add Thing , pressing the button on the module for few seconds, the smartthings app reported that a new Thing was found.

You are right the device was with Device Handler name “Thing”, I changed to “ZigBee Multi Switch”. This is very common and happen in all me Xiaomi Zigbee sensors. I assume that it is OK.

Well, I am willing to give that a try. Please give some instruction how add my device FingerPrint and re-write the DH.

I must add that this device is perfectly worked with Tuya Zigbee hub. Waiting for your instructions … Remote Desktop control is also welcome just PM me.

This device won’t work with “zigbee multi switch” device handler, because it is not a standard multi endpoint switch.

As you can see in the raw description, there is EF00 zigbee cluster, which is tuya manufacturer specific zigbee cluster.

It will be communicating using tuya cluster, not the standard onoff cluster, so you will need tuya cluster specific DTH for this switch.

1 Like

Thank you for the detailed answer.

As I can understand, I need to add to “Zigbee Multi switch” that was suggested here with updated child device stay online ,another line containing my FingerPrint:

fingerprint profileId: “0104”, inClusters: “0000, 000A, 0004, 0005, EF00, 0019”, manufacturer: " _TZE200_5apf3k9b", model: “TS0601”, deviceJoinName: “My Module Switch 1” //My Module 2 Gang Switch 1

And at the end . something like :

} else if (device.getDataValue(“model”) == “TS0601”) {
return 2

Is that correct ? I’m not a programmer but can understand really quick how things are working

What to do with EF00 , can I ignore that ?

Any help is appreciate :pray:

@dotan_shai
If it were a standard multi endpoint zigbee multi switch, then that sort of sourcecode modifiction will work.

But there are a lot of tuya zigbee switches out there, which uses their own protocol (using EF00 cluster) instead of standard mult endpoint of onoff cluster.

In that case, that kind of sourcecode modification won’t work at all, and you need to rewrite DTH using tuya protocol.

1 Like

The link below is zigbee2mqtt’s implementation of another tuya TS0601 switch.

You can find out from the sourcecode of zigbee2mqtt that, the implementation does not use standard onoff cluster, but tuya’s own EF00 cluster.

1 Like

This is wonderful information and progress.
Still , as I mentioned, I’m not a programmer and this looks like chinese for me…
Can you write some guidelines how to use this in order to merge that into zigbee multi switch existing handler ? Or how to create a device handler from that information. Any help is highly appreciated…

If you understand source code of DTHs, then you can take a look at DTHs that I have written for tuya curtains and tuya thermostat devices, and merge them into the format of DTH with child switches, like zigbee-multi-swtich.


But I cannot write you a DTH without physical device, because it is very hard to debug.

1 Like

Hi @iquix
I was reading your post and i though to ask one question
I have a zigbee module that can easily connected to smartthing and identify as “Thing”
But after using Zigbee Multi switch DTH, the switch goes off by it is own after 2 mins

It is 2 gangs switch that works in Tuya zigbee hub. These are the parameters i’m getting in IDE :

Data :

  • application: 41
  • endpointId: 01
  • manufacturer: _TZ3000_fvh3pjaz
  • model: TS0012
  • onOff: catchall
  • zigbeeNodeType: SLEEPY_END_DEVICE

Raw Description :
01 0104 0100 01 04 0000 0004 0005 0006 02 0019 000A

Is this using the standard onoff cluster, or tuya’s own cluster?

Thanks for your time!

I’m not sure, but regarding source code of zigbee2mqtt, it seems that it uses standard multi endpoint switch.

Zigbee Multi switch DTH works as 2 gang switch by default, so I’m not sure why it’s not working properly and turning off by itself.

Thanks for your reply
I can see you have added my device name in above TS0012, how i can test?
Can you please have a look to my live debug logs maybe you can catch something wrong?