#Display Precision not honored after 2025.7.0

1 messages · Page 1 of 1 (latest)

orchid thistle
#

I am finding that the set Display Precision for a bunch of my Temperature and Humidity sensors is no longer being honored in the Front End.

#

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 + " %" ]]]```
craggy bobcat
#

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

orchid thistle
#

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?

craggy bobcat
#

accuracy_decimals was changed to set the display_precision

#

not the raw state

orchid thistle
#

But if the source sensor in ESPHome has of accuracy_decimals: 1 how can the state be 39.564338684082?

craggy bobcat
#

accuracy_decimals was changed to set the display_precision
not the raw state

orchid thistle
#

So what changed in 2025.7.0 that causes this and is there a way to fix it?

craggy bobcat
orchid thistle
#

Is there a way to format the display on the [[[ return states['sensor.env_master_ambient_humidity'].state + " %" ]]]

craggy bobcat
#

I'm sure there must be. That's just javascript right?

orchid thistle
#

I am not sure to be honest

craggy bobcat
#

guessing but maybe try this:

  [[[ return Number(states['sensor.env_master_ambient_humidity'].state).toFixed(2) + " %" ]]]
orchid thistle
#

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

craggy bobcat
#

Jinja is for core templates: {{ }}

#

That thing in custom button card is not a core template but just evaluates arbitrary javascript in the browser.

orchid thistle
#

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?

craggy bobcat
#

I don't know what you mean it was changed in ESPHome. That pull request is a home-assistant/core pull.

orchid thistle
#

Gotcha, I think I got crossed up looking at core change you sent and clicked the link to the Implemente HA suggested_display_precision Issue

#

Seems like if I set accuracy_decimals: 1 in the ESPHome config that is what it should send to HA