Display two decimal places in the dashboard

You could create a template sensor for display only, forcing the state to a string by adding the units on the end. Bit ugly, but it’s the best you can do:

template:
  - sensor:
      - name: Exported electricity as string
        state: "{{ '{:.2f}'.format(states('sensor.exported_electricity_today')|float(0)) ~ ' GBP/kWh' }}"

or:

        state: "{{ '£' ~ '{:.2f}'.format(states('sensor.exported_electricity_today')|float(0)) ~ ' per kWh' }}"
1 Like