Temperature history in Graph


I would like to have the temperature sensor of my floor heating in a graph.
But since the temperature is only displayed in the state of the heating, I have created the following sensor:

  - platform: history_stats
        value_template: "{{ state_attr('climate.smart_thermostat_210940168395749','current_temperature')}}"

In the new sensor, the current temperature is displayed correctly. But when I look at the sensor in the history, I only see a bar with the temperatures.

But I would like to have a graph. Something like that:

How can I do that?

Thank you.

add a unit_of_measurement: and device_class: temperature

EDIT: Actually, that configuration is wrong. Why is your platform: history_stats yet your configuration matches the legacy template sensors?

Add a unit_of_measurement: to your sensor config. Only sensors with units get graphed like that.

Also that is the wrong sensor platform.

Add this to your configuration.yaml file instead:

    - name: Heizung Esszimmer Temperatursensor:
      state: "{{ state_attr('climate.smart_thermostat_210940168395749','current_temperature')}}"
      unit_of_measurement: "C" # or F
      device_class: temperature 
      state_class: measurement # only include this line if you want long term statistics 

Yeah just noticed that and edited my post. Chat GPT perhaps?

Surprised it was giving any values at all!

I think you want no colon on the name, and the degrees symbol in the unit:

    - name: Heizung Esszimmer Temperatursensor
      state: "{{ state_attr('climate.smart_thermostat_210940168395749','current_temperature')}}"
      unit_of_measurement: "°C"
      device_class: temperature 
      state_class: measurement

…and note that you’ll only get the graph once the old unit-less measurements have “expired” from the graph window.

Great, thank you. That’s how it works…

1 Like