Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
916 stars 3.03k forks source link

Add support for _TZE204_nbkshs6k Presence Sensor #7742

Closed drathbone closed 4 months ago

drathbone commented 4 months ago

Added support for TS0601 _TZE204_nbkshs6k Human presence sensor

https://github.com/Koenkk/zigbee2mqtt/issues/23183

Koenkk commented 4 months ago

Does it work with the following definition?

https://github.com/Koenkk/zigbee-herdsman-converters/blob/a161ed3a0b64d4c8ea87edeed9fbdc334a010757/src/devices/tuya.ts#L7413

drathbone commented 4 months ago

Yes seems to work - the picture is wrong 😂 but it still works:

Screenshot 2024-07-08 at 12 19 49
drathbone commented 4 months ago

Correct picture for it matches this device: ZY-M100-S_2

Screenshot 2024-07-08 at 12 22 18
drathbone commented 4 months ago

Changed Model to ZY-M100-S_2, and that looks to be working with the correct image:

Screenshot 2024-07-08 at 12 25 19 Screenshot 2024-07-08 at 12 25 32
drathbone commented 4 months ago

ci looks to be failing on prettier check. Not sure why, I've run it offline, and whilst prettier detects code format issues with tuya.ts, it fixes nothing 🤷‍♂️ 👍

❯ prettier --check tuya.ts
Checking formatting...
[warn] tuya.ts
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
❯ prettier --check tuya.ts --write
Checking formatting...
[warn] tuya.ts
[warn] Code style issues fixed in the above file.
❯ prettier --check tuya.ts
Checking formatting...
[warn] tuya.ts
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
Koenkk commented 4 months ago

As the definition works, could you add it to https://github.com/Koenkk/zigbee-herdsman-converters/blob/a161ed3a0b64d4c8ea87edeed9fbdc334a010757/src/devices/tuya.ts#L7413 and use the tuya.whitelabel for proper detection? (search tuya.ts for examples)

drathbone commented 4 months ago

Just to be clear, I changed the Model line in the code I'd written, and all it seemed to do was change the image - all the datapoints I'd setup stayed the same and work the same.

From looking at the ZG-204ZL definition in tuya.ts, it is exposing 2 datapoints that are not relevant to this new model: 4 (Battery) - this is a USB plugged in device, and 102 (illuminance_interval) - which is not a dp that shows up for this device in tuya dev.

I guess it's about trying to keep down the increasing size of tuya.ts, but I'm guessing that adding this new sensor into the ZG-204ZL definition would display it with 2 datapoints that are unused (and changing them would cause extra messages/failures in mqtt).

If I'm misunderstanding your ask then my apologies.

Koenkk commented 4 months ago

It makes sense to split in that case, thanks!

Could you also submit a picture for the docs? This can be done by:

  1. Create a fork by clicking here
  2. Go to the public/images/devices directory, Add file -> Upload files
  3. Upload the files and press Commit changes
  4. Press Contribute -> Open pull request -> update title/description -> Create pull request

Make sure that: