How to deal with float accuracy?



This is coming from an MQTT sensor.

Do I deal with this on the sensor configuration level or on the lovelace level?

I’ve never see the same thing with mine - are you using the miscale addon or getting the data some other way? I also sync the scale to my iPhone health data and also get it into HA from there, and don’t get superfluous decimals there either. I do it both ways because in the past I’ve found the add-on can miss values (probably due to bluetooth range).

How is that MQTT sensor set up? Manually via YAML, or using some integration for that scale? If the former, you can round appropriately in the value_template. If the latter, you probably need to make a template sensor and round in its state.

1 Like

I had to write a converter myself and I just didn’t deal with the float issue there because I assumed I’ll have to deal with it in HA anyway but on second thought I never had that issue in Home Assistant, so apparently if I just send it with the correct precision HA will store and display it correctly. I did that now.

I couldn’t find an existing integration that would work for me. For one I’m using Home Assistant Container, so no Add-ons for me. Also, I currently can’t use BLE because of this issue.