dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 499 forks source link

IAS fingerprint check fails for TUYA TS0202 devices, fails enrolment leading erratic behaviour. #6367

Closed Monofin closed 2 years ago

Monofin commented 2 years ago

Describe the bug

During testing of one of the TUYA TS0202 series of motion sensors, I discovered that the sensor was not being enrolled properly post the integration of: https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6297

The fingerprint of the device causes a failure for the check for cluster 0x0500 at lines 177-178 of ias_zone.cpp

https://github.com/dresden-elektronik/deconz-rest-plugin/blob/50c532e6866fb97f1091f7d81baa7f536696eb7c/ias_zone.cpp#L178

(This causes very erratic behaviour of the device, occasionally updating and not at other times)

Explicitly specifying the fingerprint of the device in the DDF solves the issue, but I suspect there's something more subtle going on

  "fingerprint": {
    "profile": "0x0104",
    "device": "0x0402",
    "endpoint": "0x01",
    "in": [
      "0x0000",
      "0x0001",
      "0x0500"
    ]
  },

I'm not sure this fingerprint is 100% accurate for the device, (I'm lacking understanding of how the fingerprint mechanism works in depth), but works on the above sensor.

(If the fingerprint is definitely a requirement of the DDF, then I will update the PR that added the support in the first place)

Steps to reproduce the behavior

Include any TUYA TS0202 based (e.g. _TZ3000_otvn3lne) in the network, and check the debug logs in IAS and ERROR mode: Will show lines similar to:

No IAS sensor found for endpoint: 0x01

And: 15:48:48:651 void DeRestPluginPrivate::handleIasZoneClusterIndication(const deCONZ::ApsDataIndication&, deCONZ::ZclFrame&),196: assertion 'itemIasState' failed 15:48:48:651 void DeRestPluginPrivate::handleIasZoneClusterIndication(const deCONZ::ApsDataIndication&, deCONZ::ZclFrame&),197: assertion 'itemPending' failed

Where the sensor is failed to be enrolled due to the fingerprint check.

Expected behavior

Sensor should be enrolled successfully, fingerprint check should pass (?) as the device does contain the 0x0500 cluster.

Environment

deCONZ v2.18.2-beta, Qt: 5.11.3, Commit: 5eaa4b Firmware: 0x26780700

deCONZ Logs

Additional context

close-issue-app[bot] commented 2 years ago

Hi there.

Thank you for filing this issue. Unfortunately, we cannot help you, as you haven't sticked to the provided template and/or have not provided all information requested. Consequently, this issue has been closed.
We're more than happy to help out where we can once you raise a new issue containing all requested information in the requested format.

In this regard, please take note that:
- read the template thoroughly
- all given header lines (starting with ###) must not be deleted
- everything enclosed by <!-- --> is intended to give you guidance and should be replaced by your input specific to the issue
- Listings regarding your environment must be filled out completely where applicable (bug reports and user questions).
- Not following the template or providing insufficient information can still implicate manual closure.
- Anything that is not clearly a bug can still implicate manual closure. For support we recommend the forum: https://forum.phoscon.de
- Phoscon bugs are collected at the forums: https://forum.phoscon.de

So please, first help us a bit to help you!