#Display Precision not honored after 2025.7.0
1 messages · Page 1 of 1 (latest)
Here ia the code for the bottom right button, sensor.env_master_ambient_humidity has an accuracy_decimals: 1 in ESPHome for the bme680 and the front end has a Display Precision of 1 decimal place. Changing it to 2 or 0 is no longer honored by v2025.7.0
entity: sensor.env_master_ambient_temp
aspect_ratio: 1/1
size: 65%
color_type: icon
color: rgb(3, 169, 244)
icon: mdi:bed
tap_action:
action: navigate
navigation_path: /lovelace/master
name: Master
show_state: true
show_label: true
show_name: false
styles:
card:
- font-size: 14px
label: |
[[[ return states['sensor.env_master_ambient_humidity'].state + " %" ]]]```
It's up to the custom card to handle that.
You're just telling the template to print the state, which has nothing to do with display_precision
is there a way to round() it in the return states?
The source sensor has an accuracy_decimals: 1, so how can it have 20-15 places of accuracy?
But if the source sensor in ESPHome has of accuracy_decimals: 1 how can the state be 39.564338684082?
accuracy_decimals was changed to set the display_precision
not the raw state
So what changed in 2025.7.0 that causes this and is there a way to fix it?
Is there a way to format the display on the [[[ return states['sensor.env_master_ambient_humidity'].state + " %" ]]]
I'm sure there must be. That's just javascript right?
I am not sure to be honest
guessing but maybe try this:
[[[ return Number(states['sensor.env_master_ambient_humidity'].state).toFixed(2) + " %" ]]]
Nice, that works! Is there a guide for what other options are available? And that is just Java, thought it was Jinja or something like that
Jinja is for core templates: {{ }}
That thing in custom button card is not a core template but just evaluates arbitrary javascript in the browser.
The odd part is this was changed in ESPHome 2025.6.2, but broke in Core 2025.7.0. Or was it that Core 2025.7.0 implemented the ESPHome 2025.6.2 change?
I don't know what you mean it was changed in ESPHome. That pull request is a home-assistant/core pull.