Can I graph past 24 hours temperature

I have the weather displayed on my dashboard. But can I chart the temperature and humidity values from that component? I’d need to store them every half hour or what ever. Is this possible?

Sure, if those are states (you can make them states by using a template sensor if they’re attributes) you can use a history graph card.

1 Like

That looks like exactly what I want. I don’t have a sensor thought. I was hoping to get the data from the “built in” weather card I have, which I didn’t add - so assume it’s a default weather provider.

Edit! Ah! I read that incorrectly. I read “temperature sensor” but you said “template sensor”. So I can somehow read the data from the weather plugin into the template sensor. And then get the data from the template sensor?

I’ve had great success with this: https://github.com/kalkih/mini-graph-card

2 Likes

Yes. Look in Developer tools -> States

You can see every entity, and their attributes, in there. For my setup, where I’m using weather.dark_sky I could pull that into a template sensor with:

sensor:
  - platform: template
    sensors:
      current_temperature:
        friendly_name: Current temperature
        value_template: "{{ state_attr('weather.dark_sky','temperature') }}"
        unit_of_measurement: "°C"

That will create sensor.current_temperature that you can graph. Check your own entities and attributes to see what will work for you.

3 Likes

Here is an updated version in the “modern” template syntax, plus humidity, in case someone comes across this post later like I did (my weather is called weather.home and is in Fahrenheit):

template:
  - sensor:
      - name: Outdoor temperature
        state: "{{ state_attr('weather.home','temperature') }}"
        unit_of_measurement: "°F"
      - name: Outdoor humidity
        state: "{{ state_attr('weather.home','humidity') }}"
        unit_of_measurement: "%"
7 Likes

Hi, has the syntax changed?

I’ve tried to use this but the graph just shows 0 values as below

Capture

Similary, I’m only getting a single value, the current temperature.
When I go to the Statistics list, I don’t see this … I’m wondering what else is needed to make a Sensor be databased, to turn into a Statistic?

I had help on Discord. I was pointed to Sensor Entity | Home Assistant Developer Docs which says it needed a state_class like this:

template:
  - sensor:
      - name: Outdoor temperature
        state: "{{ state_attr('weather.home','temperature') }}"
        unit_of_measurement: "°F"
        state_class: measurement

I was also told measurements should be stored anyway; declaring them a statistic means they’re not purged.

5 Likes