Skip to content

Is it possible to format (e.g decimal places) an entity? #986

Discussion options

You must be logged in to vote

Yes that is possible.
Just add .toFixed(2) to the code for 2 decimals.

So it becomes:

      ${card.querySelector('.bubble-sub-button-2').innerText =
      hass.states['sensor.co2click_temperature'].state.toFixed(2)}

More info:
https://www.w3schools.com/jsref/jsref_tofixed.asp


If this solves your issue, please mark this as solved.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Juggler00
Comment options

Answer selected by Juggler00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment