marcokreeft87 / room-card

Show multiple entity states, attributes and icons in a single card in Home Assistant's Lovelace UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Info entities doesn't reflect the new sensor display precision setting

kajarit opened this issue · comments

Is your feature request related to a problem? Please describe.
For example I set a temperature value to be displayed without decimals, then the info_entities part still uses the original precision for display.

Have you tried if it is already a feature? Have you checked the wiki?
The display precision for sensors was introduced just now, in release 2023.3

Describe the solution you'd like
It would be great if the display of sensors would use this new feature.

Describe alternatives you've considered
none

Additional context
none

Sorry for the late response, but this isn't something HA passes to the card. You can set the precision like shown here
https://github.com/marcokreeft87/room-card/wiki/Configuration#formatting:

precision<0-9> Set decimal precision of number value (precision3 -> 18.123)

Thanks for the help, I just missed this part in the documentation.

I thought that this is a generally available function which could be used in any custom card. The new feature announcement states that:

`The examples below show the output of a temperature sensor with state 20.001, unit °C and user configured presentation rounding set to 1 decimal.

The following example results in the string "20.0 °C": `

{{ states('sensor.temperature', with_unit=True) }}

Unfortunately, thats now how it works. HA has its own parsing and not everything is available in the javascript libraries.

It looks like this may no longer be the case, as the third party mushroom custom card is showing numbers with the precision set in home assistant where room-card is not. I've not looked into mushroom's code to see what it's doing differently, but I have tested and seen mushroom updating the precision of numbers where room-card is not.

It would be awesome if this precision handling could be backported into room-card now <3

It sounds like I need to have another look at this

@marcokreeft87 Shouldn’t we reopen this issue?