Sensor not displaying last digit when zero

Hi All,

I’ve got a number of sensors on my dashboard that are not displaying the last digit when that digit is zero. The value below should show £0.90.

Screenshot 2023-07-28 093122

Is there an easy way to get the zero to show? - I’ve tried to ‘round’ the sensor, but still doesn’t show - as soon as the last digit isn’t zero, then the entire value is shown.

type: custom:mushroom-template-card
primary: Cost Today
secondary: £{{states('sensor.electricity_cost_today') }}
icon: ''
entity: sensor.electricity_cost_today
  action: more-info
style: |
  ha-card {
    text-align: center;


Try this:

secondary: £{{ '{:.2f}'.format(states('sensor.electricity_cost_today')) }}

I just get a syntax error I am afraid Tom

It helps us if you actually post the error. We can no longer mind read since the “great disaster” of 2022.

Try this:

secondary: "£{{ '{:.2f}'.format(states('sensor.electricity_cost_today')|float(0)) }}"

Spot on thanks Tom