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

Round battery percentage? #5

Closed svrooij closed 7 years ago

svrooij commented 7 years ago

I sometimes get a weird battery percentage like 56.99999999999999%, maybe this line should be:

return Math.round(((SUBDEVICE_MAX_VOLT - this._voltage) / (SUBDEVICE_MAX_VOLT - SUBDEVICE_MIN_VOLT)) * 100)