Closed andrew-codechimp closed 8 months ago
Unfortunately this may not work. Tuya seems to offer multiple devices with the same model number that have different batteries. https://github.com/andrew-codechimp/HA-Battery-Notes/blob/8d29c668facb36ea1b7b1e034d0cce1aea1ea264/custom_components/battery_notes/data/library.json#L15C10-L25
If there are multiple devices with the same model we can change those to MANUAL to stop discovery, I'm also not ruling out bad data either. I will still wait for more examples to know if the trailing random characters are something like a mac address to wildcard.
There may also be another format of manufacturer, will have to keep an eye on ones in the format of TUYATEC-xrvzm3yI
This might be awkward to manage for submissions but you could adjust the JSON schema to something like this...
{
"devices": [
{
"manufacturer": [
"_TZ3000_fllyghyj",
"_TZ3000_xr3htd96"
],
"model": "TS0201",
"battery_type": "AAA",
"battery_quantity": 2
},
{
"manufacturer": [
"_TZ3000_dowj6gyi"
],
"model": "TS0201",
"battery_type": "CR2450"
}
]
}
This would allow you to maintain multiple manufacturers for the same model with different battery types as well. If you can't wildcard then you'll have to look them up somehow.
Changing the schema will be of last resort, the library is only growing because the schema is approachable and now automated. I've not got enough so far to determine what exceptions there are and to fact check the battery details.
I just opened another of the Tuya door sensors I bought last month. The first one I opened was TS0203 by _TZ3000_yxqnffam. The second one is also the same, so it's not unique per-device. My hunch is that the unique-looking string is related to what firmware the device is running.
Interesting, thanks for investigating. It may still warrant a wildcard but at least it's not per device so does have some re-use as it is currently.
IIRC Zigbee2Mqtt uses these to identify manufacturers and models when the device joins the mesh. These ideas are used to differentiate between those that are the same.
As an example, I recently had some ClickSmart+ sockets that were identified as a Tuya device. Supplying the _TZ string, icons and details of the manufacturer and model Allowed the UI to show the correct icon when these devices are on the ZigBee network.
I would hazard a guess that these strings are unique per manufacturer as part of some kind of OEM agreement. I would also assume that a single manufacturer can have multiple of these strings associated with them and potentially for the same model.
Since the manufacturers are alternative branding/revisions and there is some discrepancy in battery types between the revisions I'm closing this issue. Not getting a lot of these come through so far anyway.
Checklist
Is your feature request related to a problem? Please describe.
It appears Tuya devices generate unique manufacturer ID's for the same model as demonstrated below.
_TZ3000_dowj6gyi | TS0201 _TZ3000_fllyghyj | TS0201
_TZE200_b6wax7g0 | TS0601 _TZE200_c88teujp | TS0601 _TZE200_locansqn | TS0601
Describe the solution you'd like
Modify the library to support a manufacturer of
_TZxxx_*
to allow matching all modelsDescribe alternatives you've considered
Do not allow submissions of _TZ devices as they won't be any use to anyone but the submitter
Additional context
I personally don't have any of these devices so if anyone who has a few of them can give additional context that would be helpful.