Howto add a template value to Dashboard?

Hi, finally I am having a working template, but…

Goal is to have a needle gauge on my dashboard with a total of used kWh per day. Using 3rd party integration Utility meter and P1monitor

template:
  - sensor:
    - name: 'Daily Energy Total'
      device_class: energy
      unit_of_measurement: kWh
      state: >
          {% if is_number(states('sensor.daily_energy_offpeak')) and is_number(states('sensor.daily_energy_peak')) %}
          {{ states('sensor.daily_energy_offpeak') | float | round(1) + states('sensor.daily_energy_peak') | float | round(1)}}
        {% else %}
          None
        {% endif %}

Results at this moment in a value, a rounded number (string) “14.8”. How can I add this value to my Dashboard in a needle gauge?

The gauge card has a needle option.

I know about the guage card. The problem is that the sensor (probably because of the template) is not available as such. It is not visible as an entity.

Not clear what you mean by that.
Entity states are always strings, so “14.8” is a valid value.
Please tell us what you mean by “not available”.

If I select the gauge this is what I see:

Has it got something to do with the predefined lines in the template?

- sensor:
    - name: 'Daily Energy Total'
      device_class: energy

If sensor.daily_energy_total exists, I see no reason why you cannot select it…

Hi, I also do not know why it is not there.
Just wondering if it would not be easier to use a Helper - Group instead of template. In group, select Sensor, select the two source sensors and apply the SUM option.

1 Like

There was no sensor.daily_energy_total so I couldn’t select it. It seems that the template is not necessary at all because the solution to use a Helper-Group and SUM did the trick. Maybe the samples (Utlitly meter) are outdated or I misunderstood.

Thx for the help!
image