-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal how to handle duplicate zigbeeModels #2778
Comments
These devices are actually all from TUYA, the problem is that the manufacturerName is also the same :( |
Ah, you're saying the Zemismart TS0001 == CR Smart Home TS0001 == my "Wireless Smart Switches" TS0001? :( If so, can we at least combine to one entry with the same fromZigbee and toZigbee entries? or do they differ as well? :( Let me for prosperity sake include the database entry, so we can figure out if the others are really identical or not: {"id":43,"type":"Router","ieeeAddr":"0xec1bbdfffe0f96d1","nwkAddr":21142,"manufId":0,"manufName":"_TYZB01_seqwasot","powerSource":"Mains (single phase)","modelId":"TS0001","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,3,4,5,6],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TS0001","manufacturerName":"_TYZB01_seqwasot","powerSource":1,"zclVersion":3,"appVersion":66}},"genOnOff":{"attributes":{"onOff":0,"onTime":0,"offWaitTime":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001949ee82","endpointID":1}]}},"appVersion":66,"zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":null} |
What type of device is your |
It's a 1-gang, L+N switch for EU, (so it fits existing EU home wall mounts) |
Taken from here: Koenkk/zigbee-herdsman-converters#810 (comment)
As you can see the manufacturerName is the same, AFAIK the part after |
Yeah, I guess there is not much to gain except for making the name look prettier. Ow well, lets table this then till we really bump into a double modelID :) Feel free to close the topic if you agree. |
I would like to keep this open to gather more |
@Koenkk just a note for Z-Stack 3.1.0-3.5.0, Model ID is not a require one, you can see it here http://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread/f/158/t/875025 |
Hmm, that is interesting. Looking through the the NXP ZCL, I also see the attribute is indeed not mandatory. (my only reference i had handy). I'm unable to find anything useful on "TI Sensor to cloud" except a bunch of Bluetooth and 1352 development boards. Do you have a link handy? |
I was thinking that maybe we can distinguish between devices when they have different endpoints, or different supported clusters, appVersion, zclVersion, etc. But even this is identical for these 2 devices, however this may not be the case if two devices are sharing the modelID where one is a bulb and the other one is just a switch. The switch would then e.g. not support the brightness cluster. |
That's how SmartThings is working... there's a feature called fingerprinting which is doing that: https://docs.smartthings.com/en/latest/device-type-developers-guide/definition-metadata.html#fingerprinting |
Hi, Interesting, but that will be a fairly big configuration shift. Instead of well, findByModelID(), the function now needs to be given the full device, in order to match on some (/every possible [1])? attribute. It would save a tremendous amount of support though, as most devices would just fall into place and one when ppl complain "the battery voltage is always empty", we can hunt down what is special about it. So the device list will now be a list of "handlers", say "Generic Light", with the proper fromZigbee and toZigbee lists and whats not. Such a handler will also have a (list of) finger prints, which needs to be intelligently matched against the devices. And the more matches a finger print has the more preferential it will be, say the What will be crucial here is that at interview time, when we have a bunch of more information than we retain in the database (I think), we need to find the correct handler and either retain it's handler_id in the device database, or keep enough of the attributes[1] around so we can find the same handler for the device over and over again. It might be possible to go a step further and discover multiple handlers for a device, for example, if a device is both a relay (on/off) and a switch (on/off switch) or even multiple switches. That way most of out current devices would collapse into a few on/off handlers (a single ssIasZone and ssIasWd handler, yes!) and some specialized battery voltage/percentage handlers. Downside is that the configuration would be harder to explain to a casual "editor", as their device would be all over N handlers. On the other hand, it should be easy enough to make a test which yells loudly when two handlers have the same fingerprints. Maybe we should even require some database entry to be added for each device, so we can assert each device will always end up with at least one handler. I guess the handlers also need to way to inform the higher up
Thoughts? [1] looking at the smartthings page, it seems they only use the in/out clusters and the manufacturer and modelid as entries. Which might be identifying enough. |
I don't think we should go that far and I want to go for a much simpler approach as the
Let's say we have 2 device definitions: // device A
{
zigbeeModel: ["mymodelID"],
...
},
// device B
{
zigbeeModel: ["mymodelID"],
fingerpint: {endpoints: {1: {inputClusters: ["genBasic", "genLevelCtrl"]]}}
...
}
|
I'm not sure if this is going to work for my device from #2677. The device also identifies itself as being capable of handling HSV attributes. I'd need to check logs/traffic, but I'm pretty sure that the Hue bridge doesn't have a DB like Z2M. Probably, Paul Neuhaus just uses the same Jennic Zigbee interface over and over again. (Pretty bad for a €329 light...) |
@TilmanK so it also has |
I'd need to capture that traffic again, since I didn't get the appropriate message (I need to move the stick closer...). But like I said, my Hue bridge also thinks that it supports color and happily reads color properties: I'll be sure 100% when I find the time to capture the logs for the timeout issue. |
No need to sniff, you can find it in |
{"id":29,"type":"Router","ieeeAddr":"0x00158d0002a6d294","nwkAddr":41527,"manufId":4151,"manufName":"Neuhaus Lighting Group ","powerSource":"Mains (single phase)","modelId":"NLG-RGBW light ","epList":[1,2],"endpoints":{"1":{"profId":49246,"epId":1,"devId":4096,"inClusterList":[4096],"outClusterList":[4096],"clusters":{},"binds":[]},"2":{"profId":49246,"epId":2,"devId":528,"inClusterList":[0,4,3,6,8,5,768],"outClusterList":[0,25],"clusters":{"genBasic":{"attributes":{"modelId":"NLG-RGBW light ","manufacturerName":"Neuhaus Lighting Group ","powerSource":1,"zclVersion":1,"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20150821","swBuildId":"1001-0007"}}},"binds":[]}},"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20150821","swBuildId":"1001-0007","zclVersion":1,"interviewCompleted":true,"meta":{},"lastSeen":1579971066266} Yes :/ Like I said, I believe they are using the same Zigbee module for every device. |
So it has 768 (Colour Control Cluster) which includes attributes for HSV. So I think it would work. In this case the device fingerprint would contain something like this:
it seems that endpoint 1 only contains touchlink and endpoint 2 the interesting parts of the device. I also find it interesting the inclusters on ep2 are completely unsorted. guess they made their own zigbee stack. Which seems reasonable for the 329 euri expense :) |
So, to return to the original thread, I summarize:
And finally, as a general statement, zigbeeModel is actually just another fingerprint attribute, it does not require the special handling we give it here. Ok? good plan? |
@TilmanK but if I understand correctly, this device does not support colour right? |
@Koenkk You do. I have contacted the vendor. They asked for a picture of my coordinator. That’s going to be fun... I guess we can’t identify the devices correctly. Should we add something to the docs about this? |
Yes, feel free to create a pr for it. |
I bought a Lonsonho 2 way wall switch: https://www.aliexpress.com/item/4000298926256.html?spm=a2g0s.9042311.0.0.27424c4dJg7Xdr Which reports itself as a TS0002 which is also reported by the Zemismart ZM-CSW002-D. The database.db entry: {"id":10,"type":"Router","ieeeAddr":"0xec1bbdfffe9303fe","nwkAddr":54693,"manufId":0,"manufName":"_TYZB01_6sadkhcy","powerSource":"Mains (single phase)","modelId":"TS0002","epList":[1,2],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,3,4,5,6],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TS0002","manufacturerName":"_TYZB01_6sadkhcy","powerSource":1,"zclVersion":3,"appVersion":66}},"genOnOff":{"attributes":{"onOff":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001936657c","endpointID":1}]},"2":{"profId":260,"epId":2,"devId":256,"inClusterList":[0,3,4,5,6],"outClusterList":[25],"clusters":{"genOnOff":{"attributes":{"onOff":0}}},"binds":[]}},"appVersion":66,"zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1580552729474} Using the 1.9.0 devices.js I get this error: error 2020-02-01 11:32:11: Failed to configure '0xec1bbdfffe9303fe', attempt 2 (Error: Timeout - 54693 - 1 - 2 - 6 - 7 after 10000ms |
@BastiaanNaber probably the same story as the 1 gang switch, technically devices are identical and based on the fingerprint not distinguishable. That also means it should already work. Please try again with the latest zigbee2mqtt dev branch, it has improved logging so we can see where things go wrong. I've created an overview of the duplicate device ids': https://docs.google.com/spreadsheets/d/1SVIVH6kcuKCCEcFn5h7svuYbE2rF_AVl1IH0360ztSc/edit?usp=sharing As you can see Lonsoho 1 gang is identical to the Zemismart ZM-L01E-Z (1 Gang) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
poke, not stale, just slow. |
I just faced the model ID conflict with this Lonsonho wired switch: {
"id": 2,
"type": "Router",
"ieeeAddr": "0xec1bbdfffe69c0b5",
"nwkAddr": 6890,
"manufId": 4098,
"manufName": "_TZE200_8vxj8khv",
"powerSource": "Mains (single phase)",
"modelId": "TS0601",
"epList": [ 1 ],
"endpoints": {
"1": {
"profId": 260,
"epId": 1,
"devId": 81,
"inClusterList": [ 0, 4, 5, 61184 ],
"outClusterList": [ 25, 10 ],
"clusters": {
"genBasic": {
"attributes": {
"modelId": "TS0601",
"manufacturerName": "_TZE200_8vxj8khv",
"powerSource": 1,
"zclVersion": 3,
"appVersion": 64,
"stackVersion": 0,
"hwVersion": 1,
"dateCode": ""
}
}
},
"binds": []
}
},
"appVersion": 64,
"stackVersion": 0,
"hwVersion": 1,
"dateCode": "",
"zclVersion": 3,
"interviewCompleted": true,
"meta": {},
"lastSeen": 1591130632063
} For every click on one of three buttons, it sends three messages (one per available button):
I guess |
HI @artem-dudarev |
@tabletka-ao In general, I've succeeded with configuring the X711A switch. It works fine with my Home Assistant, but I still need to make some changes to use both X711A and X712A at the same time. Since they have the same Here is how to reproduce my current configuration:
{
zigbeeModel: ['TS0601'],
model: 'X711A',
vendor: 'Lonsonho',
description: '1 gang switch',
supports: 'on/off',
fromZigbee: [fz.tuya_switch_new, fz.ignore_time_read],
toZigbee: [tz.tuya_switch_state],
endpoint: (device) => {
// Endpoint selection is made in tuya_switch_state
return { 'l1': 1, 'l2': 1, 'l3': 1 };
},
},
tuya_switch_new: {
cluster: 'manuSpecificTuyaDimmer',
type: 'commandGetData',
convert: (model, msg, publish, options, meta) =>
{
const dp = msg.data.dp;
const state = msg.data.data[0] ? 'ON' : 'OFF';
switch (dp) {
case 257: // 0x01 0x01:
return { state_l1: state };
case 258: // 0x01 0x02:
return { state_l2: state };
case 259: // 0x01 0x03:
return { state_l3: state };
}
}
},
'X711A': [switchEndpoint('l1')],
'X712A': [switchEndpoint('l1'), switchEndpoint('l2')], |
@artem-dudarev be cautious to identify this based on the manufacturerName as this can differ for every tuya device. It will be better to differentiate based on the clusters, you can find a |
Is there's no easy way to generate a universal identifier I propose the following:
|
@dzegarra that should indeed be done when the |
@Koenkk examples switches with modelid of the curtain motor Switch 1 gang
Switch 2 gang
|
@cchalong since you have a TS0601 curtain motor, could you share the |
#3821 (comment) shows another device using |
@Koenkk Looks like "manufName" are different for different devices |
Unfortunately, I do not have these devices. in our chat users also complain that some switches are defined as "curtains". |
Sniff log should show the transmission of parameters by which the Tuya gateway determines which device it interacts with. It seems that the model name is no longer a defining parameter for Tuya. |
@Koenkk I don't see any problem here. If there are four identical thermostatic valves, why would they have different properties? _TZE200_ckud7u2l - thermostatic valve |
@Foroxon @artem-dudarev it seems that the manufacturer name is indeed different, I initially thought that this would also differ per device type but #3821 (comment) shows 4 times the same for the valve so that seems to be an invalid assumption. @nukusinji since you added initial support for the TS0601 curtain, can you share the |
Let's use manufacturer as part of the fingerprint for these devices. Like here: https://github.com/iquix/Smartthings/blob/master/devicetypes/iquix/tuya-window-shade.src/tuya-window-shade.groovy#L27-L30 |
I think |
@artem-dudarev I'm not sure about that, this will have a big downside when the fingerprint doesn't exactly match and it will fallback to the zigbeeModel which will lead to wrong identification (and confusion). This can easily happen for the TuYa devices as one specific device can have multiple |
@Koenkk As far as I understand, the fingerprint feature was introduced to resolve the issue with duplicating zigbeeModels, which means that fingerprint should be a more precise identifier than zigbeeModel. And nothing prevents to build such a precise identifier because fingerprint can contain multiple attributes of the device. When zigbeeModel is checked first, it's even impossible to add both X711A and X712A switches via the external converter because both of them have zigbeeModel TS0601 and this model conflicts with the existing curtain motor. As for Tuya devices, I believe different manufacturerNames belong to different devices. They might look very similar but they are still different devices (from different vendors, for example) that have firmware based on the Tuya framework. |
@artem-dudarev after seeing the same issue in Koenkk/zigbee-herdsman-converters#1162 I'm convinced that identification through fingerprint should be done first indeed. Implemented this now, thanks for the discussion. As I believe the OP issue has been fixed by introducing identification via fingerprint, I assume this can be closed now. |
Greetings,
I recently bumped into an Aliexpress Lonsonho? 1-gang switch which reports TS0001 as its zigbee model ID. So I joined it to my network and it reported itself as a "CR Smart Home Valve Control". That cannot be right... Well, it is. It seems there is no handling for duplicate zigbee Models, the assumption being, like model numbers, that all manufactures work together to have each zigbeeModel unique.. Right :) For now it looks like TS0001 will be the one device having this issue, with 3 manufactures, as there is already a different TS0001 commented out. But there is no guarantee it will not happen for other devices.
So I can see only one way to solve this, by including the manufacturer Name in the FindByZigbeeModel() search. Downside is that existing devices don't have manufactures listed, so it needs to fall back to the current behavior if that is the case. We can change the uniqueness test to assert that the zigbeeModel is unique per manufacturer.
So, how to add this manufacturer name? Keep in mind, as we allow multiple zigbeeModels per device, we need multiple zigbeeManufactuerers as well, which need to pair up.
E.g.
{ zigbeeModel: ['TS0012', 'TS0001'], zigbeeManufactuerer: ['Something', 'Spooky'], }
or we encode it in the model name with a special separator.
E.g.
{ zigbeeModel: ['TS0012/Something', 'TS0001/Spooky'], }
or, uhm. tuples?
E.g.
{ zigbeeModel: [ ['TS0012','Something'], ['TS0001','Spooky'] ], }
I think I prefer the first, as it reads the simplest and as devices.js needs to be maintained by non-programmers, simplest is a good criteria...
Any thoughts? Suggestions? I'm happy to provide patches if this meets approval.
The text was updated successfully, but these errors were encountered: