Unit for temperature is % rather than °F when graphed

I’m just starting to use templates so maybe I’m doing something wrong…

I’m trying to graph outside and inside temperature with a History Graph card.

I had to make a template for the sensors using weather.home (outside temp) and climate.thermostat (inside temp)

  - platform: template
    sensors:
      current_outside_temperature:
        friendly_name: Current Outside Temperature
        value_template: "{{ state_attr('weather.home','temperature') }}"
        unit_of_measurement: "°F"
    
      current_inside_temperature:
        friendly_name: Current Inside Temperature
        value_template: "{{ state_attr('climate.thermostat','current_temperature') }}"
        unit_of_measurement: "°F"

Both units are in °F but when I graph them, the Inside Temperature is using % and Outside Temperature is using °F.

When I originally made the template I think I accidentally had the unit for Inside Temperature as % (I had copied the code from a humidity sensor), but I have since fixed it and restarted HA.

Any ideas?

Try this:

  - platform: template
    sensors:
      current_outside_temperature:
        friendly_name: Current Outside Temperature
        value_template: "{{ state_attr('weather.home','temperature') }}"
        unit_of_measurement: "°F"

  - platform: template
    sensors:    
      current_inside_temperature:
        friendly_name: Current Inside Temperature
        value_template: "{{ state_attr('climate.thermostat','current_temperature') }}"
        unit_of_measurement: "°F"

For the one showing %, it is probably the first entries in your database use %, and applies it to any graph.

You can delete them via sql, or wait for them to drop out of the database after your purge_keep_days expires.

I also find I have more control over my graphs using this:

That will not solve the problem.