benct / lovelace-multiple-entity-row

Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI
MIT License
797 stars 60 forks source link

Value 0 shown as 0.0 #335

Open iz8mbw opened 6 months ago

iz8mbw commented 6 months ago

Hello. I use "lovelace-multiple-entity-row" mainly to show switches to turn on and turn off lights and see as second entity the power (in Watt).

See here: image

As you can see, when the switches are off the Power value is 0.0 W (this is the default when Home Assistant boot/starts). If I turn on the switch I can see the Power value in watt (using the default entity decimals) but when I turn off the Power value becomes 0 W (and so not more 0.0 W). See here: image

So it seems that by default (when Home Assistant boot/starts) the default value is "0.0" but after a value changes and when it come back to zero, it changes from "0.0" to "0".

Well, is it possible to always show "0" and not "0.0" or "0.00" when the value is 0 and have one or more 0 decimals?

Thanks.

ildar170975 commented 6 months ago

I would suggest you to check the entity’s state in Dev tools after HA boot and after turning on/ off.

iz8mbw commented 6 months ago

What I discovered is that "lovelace-multiple-entity-row" is using the decimals for "0" provided by Home Assistant so it seems the number of decimals after 0 is a value that come back from Home Assistant per each specific entity. So if/when an entity has one decimal after zero (0.0) or two decimals after zero (0.00), "lovelace-multiple-entity-row" is going to use that values. So it seems a "behaviour" of Home Assistant and not an issue of "lovelace-multiple-entity-row".

Anyway, if in some way can be possible to "force" the number of decimals to use when the value is zero it will be very usefull.

Thanks.

EDIT: I cannot reach my goal using "precision" field since it will always affect decimals not only when the number is 0 or 0.0 or 0.00

bisquit2003 commented 5 months ago

I have a similar problem. The sensor transmits a value, for example 38.5 (everywhere in the interface and in the developer panel), and the card may contain a large number of numbers after the decimal point. I noticed that this happens with xiaomi ble sensors IMG_5302 IMG_5303