jacekk015 / zha_quirks

All quirks in one place
MIT License
144 stars 20 forks source link

Battery count not correctly reported in HA - _TZE200_locansqan #45

Closed cecinitmortem closed 1 month ago

cecinitmortem commented 11 months ago

Hi,

I do not have many knowledge about quirks in HA, I just installed my first on yesterday which happened to be yours. I noticed, that my device (_TZE200_locansqan) is showing off that there are 2 AA batteries built in. However that is not the case, the device runs on 3 AAA batteries. I am definitely not a programmer but I found this line in the quirk referencing the batteries: https://github.com/jacekk015/zha_quirks/blob/69c906bb16b43f1e2d9de6a610066f5b06063710/ts0601_temperature.py#L330 The comment states correctly, that there are AAA batteries used but only two, which is not correct. I tried tracking down which correct values have to be entered and I guess that can be found here: https://github.com/zigpy/zigpy/blob/056d91401465a2d2e3b10f4d0d246f471d0d0fc8/zigpy/zcl/clusters/general.py#L288C1-L288C1 Maybe that is the cause of the problem, that my device was reporting 100% battery status for some hours after successful initialization, but jumping up to 141% after that. image

Because I do not program myself, especially not in Python I did not create a fix myself. Thanks for your work maybe I could trying to fix this.

Danieldiazi commented 8 months ago

Hi, maybe is the arithmetic average? Two batteries at 141% and each one at 70,5% ¿?

In my case, I have a Ikea device with 2 batteries and the value is 150%: imagen

Maybe is the behaviour when you have more than one battery?

Santanachia commented 8 months ago

these devices have batteries connected in series, and there is no way to measure their capacities separately and then add them up. You can't measure capacity at all, only the amount of voltage and assume that 21.5V => 100% Just what if they assumed that above 21.4V is 100%, and your batteries are 2*1.6V?

jacekk015 commented 8 months ago

_TZE200_locansqan has now a totally new quirk. ts0601_temphumid.py