Skip to content
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

Small improvements to the tuya ts0021 quirk #3373

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

rbaron
Copy link
Contributor

@rbaron rbaron commented Sep 20, 2024

Proposed change

Some cosmetic changes to the tuya.ts0021.TS0021 quirk:

  • Hide the "Opening"/"Smoke" sensor. The IaSZone cluster causes this device to be recognized sometimes as an Opening sensor, and sometimes as a Smoke sensor (see [Device Support Request] TS0021 _TZ3210_3ulg9kpo Tuya 2 gang switch #2847). This is confusing, so I removed that cluster.
  • The logbook only shows a generic "Attribute Updated event was fired" for every action (single, double, long presses). This is also confusing ([Device Support Request] TS0021 _TZ3210_3ulg9kpo Tuya 2 gang switch #2847 (comment)). I added a new zha_event that logs more specific actions like "Button 2 Double Press". I kept the old events, as not to break existing automations.
  • The battery always showed up as unavailable. I tried a bunch of things, including reading the power clusters attributes directly for the percentage_remaining, using the TuyaPowerConfigurationCluster2AAA, the TuyaNoBindPowerConfigurationCluster, waiting for 24h. But nothing seemed to work. It's likely that I'm missing something, but it's possible that the device does not expose its battery voltage/percentage. Since it's not working, I also removed the power clusters, so they don't show on the UI anymore.

Additional information

Before

Screenshot 2024-09-20 at 09 02 35

After

Screenshot 2024-09-20 at 08 58 27

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

- Hide the "Opening"/"Smoke" sensor. The IaSZone cluster causes this
  device to be recognized sometimes as an Opening sensor, and sometimes
  as a Smoke sensor (see zigpy#2847). This is confusing, so I removed that
  cluster.
- The logbook only shows a generic "Attribute Updated event was fired"
  for every action (single, double, long presses). This is also
  confusing
  (zigpy#2847 (comment)).
  I added a new zha_event that logs more specific actions like "Button 2
  Double Press". I kept the old events, as not to break existing
  automations.
- The battery always showed up as unavailable. I tried a bunch of
  things, including reading the power clusters attributes directly for
  the percentage_remaining, using the `TuyaPowerConfigurationCluster2AAA`,
  the `TuyaNoBindPowerConfigurationCluster`, waiting for 24h. But
  nothing seemed to work. It's likely that I'm missing something, but
  it's possible that the device does not expose its battery
  voltage/percentage. Since it's not working, I also removed the power
  clusters, so they don't show on the UI anymore.
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.50%. Comparing base (d9c9df9) to head (02e453c).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #3373   +/-   ##
=======================================
  Coverage   88.49%   88.50%           
=======================================
  Files         305      305           
  Lines        9621     9628    +7     
=======================================
+ Hits         8514     8521    +7     
  Misses       1107     1107           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants