marvinroger / node-lumi-aqara

Control your Xiaomi Smart Home devices with this Lumi Aqara library
GNU General Public License v3.0
46 stars 27 forks source link

fix: get more realistic battery percentage #19

Closed hobbyquaker closed 6 years ago

hobbyquaker commented 6 years ago

Most CR2032 come with around 3,0 to 3,1V, while specification allows up to 3,3V. My Magnet Sensor was still operating at 2,18V. Have changed the constants, 2,8V as min was far to high in my opinion and I think a max expectation far above 3V makes no sense either. Still left some buffer (2,35V min, 3,065V max), so I capped the percentage value to prevent going below 0 or above 100.

marvinroger commented 6 years ago

I took the data from https://github.com/home-assistant/home-assistant/blob/46ea28a4f81b121967a4041a5baa5d34e0827ac7/homeassistant/components/xiaomi_aqara.py#L295

But you are right, in practice I don't have any 3.3V batteries. Thanks for that.

marvinroger commented 6 years ago

:tada: This PR is included in version 1.7.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: