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

Fix battery reporting for _TZE200_yjjdcqsq, _TZE200_9yapgbuv #2626

Merged
merged 4 commits into from
Oct 24, 2023

Conversation

Jonas-Meyer97
Copy link
Contributor

@Jonas-Meyer97 Jonas-Meyer97 commented Oct 7, 2023

Both devices report battery status in three levels: low, middle, and high instead of reporting a battery percentage. I confirmed this with the official TuYa App and TuYa IoT Platform. See Issue #2281. I tested this for both devices: _TZE200_yjjdcqsq and _TZE200_9yapgbuv.

Proposed change

Since there is no option for battery level in ZHA, this fix converts the levels into equal percentage numbers 25%, 50% and 100%.

Additional information

Fixes #2281

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

Jonas Meyer added 2 commits October 7, 2023 04:42
I tested on both devices: _TZE200_yjjdcqsq and _TZE200_9yapgbuv.
Both devices report battery status in three levels: low, middle, and high. Since there is no option for battery level in ZHA, this fix converts the levels into equal percentage numbers 25%, 50% and 100%.

Issue: zigpy#2281
Remove `TuyaManufClusterAttributes` to satisfy CI checks
@codecov
Copy link

codecov bot commented Oct 7, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (dc8d744) 86.60% compared to head (4309e4d) 86.61%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2626   +/-   ##
=======================================
  Coverage   86.60%   86.61%           
=======================================
  Files         278      278           
  Lines        8540     8546    +6     
=======================================
+ Hits         7396     7402    +6     
  Misses       1144     1144           
Files Coverage Δ
zhaquirks/tuya/ts0601_sensor.py 100.00% <100.00%> (ø)

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

@mhombach
Copy link

mhombach commented Oct 7, 2023

Hey there. I have _TZE200_yw7cahqs devices which always show 100% battery level until the battery is dead. Could this be the same issue? Or is the issue you are fixing specifically fixing the unknown battery status? If it's a different issue, do you happen to have an idea about a fix? Sorry to hijack this PR, hard to find any information for my problem :/

@Jonas-Meyer97
Copy link
Contributor Author

Hey there. I have _TZE200_yw7cahqs devices which always show 100% battery level until the battery is dead. Could this be the same issue? Or is the issue you are fixing specifically fixing the unknown battery status? If it's a different issue, do you happen to have an idea about a fix? Sorry to hijack this PR, hard to find any information for my problem :/

I suggest opening a new issue. It's likely the maintainer wouldn't welcome a discussion about a different topic here. If you use the official thermostat app, does it display a battery percentage? The current implementation suggests that the thermostat only reports a battery low warning reported to HA as 0%. Otherwise, it shows 100%.

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Oct 7, 2023
@TheJulianJES TheJulianJES changed the title Fix battery reporting for: _TZE200_yjjdcqsq, _TZE200_9yapgbuv Fix battery reporting for _TZE200_yjjdcqsq, _TZE200_9yapgbuv Oct 8, 2023
@TheJulianJES TheJulianJES requested a review from javicalle October 9, 2023 23:50
Copy link
Collaborator

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess more Tuya devices have that "low, medium, high" battery percentage reporting, so we should probably move it to the main Tuya class if other devices also need it.

For now, this LGTM. Thanks for the PR!

@TheJulianJES TheJulianJES merged commit ccf937c into zigpy:dev Oct 24, 2023
14 checks passed
elupus pushed a commit to elupus/zha-device-handlers that referenced this pull request Jan 17, 2024
…py#2626)

* Fix battery reporting for: _TZE200_yjjdcqsq, _TZE200_9yapgbuv 

Tested on both devices: _TZE200_yjjdcqsq and _TZE200_9yapgbuv.
Both devices report battery status in three levels: low, middle, and high. Since there is no option for battery level in ZHA, this fix converts the levels into equal percentage numbers 25%, 50% and 100%.

Issue: zigpy#2281
lgraf pushed a commit to lgraf/zha-device-handlers that referenced this pull request May 6, 2024
…py#2626)

* Fix battery reporting for: _TZE200_yjjdcqsq, _TZE200_9yapgbuv 

Tested on both devices: _TZE200_yjjdcqsq and _TZE200_9yapgbuv.
Both devices report battery status in three levels: low, middle, and high. Since there is no option for battery level in ZHA, this fix converts the levels into equal percentage numbers 25%, 50% and 100%.

Issue: zigpy#2281
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.

[BUG] TS0601 _TZE200_9yapgbuv battery status is not reporting
3 participants