syssi / esphome-jk-bms

ESPHome component to monitor and control a Jikong Battery Management System (JK-BMS) via UART-TTL or BLE
Apache License 2.0
460 stars 154 forks source link

Invalid value for "max_discharge_current" : 200.000015 (range 1.0 - 200.0) #381

Closed Jalle19 closed 11 months ago

Jalle19 commented 11 months ago

My Home Assistant keeps complaining in the logs about this:

Invalid value for number.jk_bms_max_discharge_current: 200.000015 (range 1.0 - 200.0)

syssi commented 11 months ago

I will have a look!

Jalle19 commented 11 months ago

Seems like a classic floating point comparison issue. Not sure what the best fix would be, perhaps change the whole thing to use integers instead? I doubt anyone desperately needs to set discharge current to sub-ampere accuracy.

syssi commented 11 months ago

If pushed a fix which relaxes the upper limit. If the value passes the validation it should be handled/rounded properly.

Jalle19 commented 11 months ago

Yeah I guess that works too :+1: