Template Sensor help please and thank you!

I am creating this template sensor:

template:
  - sensor:
    - name: "Current Forecast"
      unit_of_measurement: ''
      icon: mdi:weather-sunny
      state: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[0].condition }}"
      attributes:
        high_temp: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[0].temperature }}"
        overnight_low: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[1].templow }}"
        wind_bearing: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[0].wind_bearing }}"
        wind_speed: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[0].wind_speed }}"
        precipitation: "{{ state_attr('sensor.hub_hb_00067984_weather','daily_forecast')[0].precipitation }}"

In Developer Tools States it is showing as ‘Unknown’. In Developer Tools Template the data is being shown:

template:
  - sensor:
    - name: "Current Forecast"
      unit_of_measurement: ''
      icon: mdi:weather-sunny
      state: "sunny"
      attributes:
        high_temp: "84.2"
        overnight_low: "57.2"
        wind_bearing: "285"
        wind_speed: "4.29"
        precipitation: "0.0"

Could someone please point out what the obvious mistake is, because I am not seeing it!
Thank you.

Remove the line containing unit_of_measurement… it is only allowed for entities whose state is numeric, yours is not.

1 Like

Oh my. Thank you so much! I knew it was something simple.

I appreciate you!