Weather Forecast: Problem with Attributes in Created Entities


I followed Simon42’s video to create weather forecast entities and I want to write information into the attributes. My code is below.

Unfortunately, no values are found, and all attributes are displayed as “unknown.”

Does anyone have an idea where my mistake is? The “Location” attribute is displayed correctly - I filled that one statically.

Thank you,

  - trigger:
      - platform: time_pattern
        hours: /1
      - service: weather.get_forecasts
            - weather.forecast_home
          type: daily
        response_variable: tagesvorhersage
  - sensor:
      - name: Wettervorhersage (heute)
        unique_id: wettervorhersage_heute
        state: "{{ now().isoformat() }}"
        icon: mdi:weather-partly-rainy
          location: "Home"
          datetime: "{{ tagesvorhersage['weather.forecast_home'].forecast[0].datetime }}"
          condition: "{{ tagesvorhersage['weather.forecast_home'].forecast[0].condition }}"
          temperature: "{{ tagesvorhersage['weather.forecast_home'].forecast[0].temperature }}"
          templow: "{{ tagesvorhersage['weather.forecast_home'].forecast[0].templow }}"

@moritzmaier Please post your questions in English as the official language of this forum. Thank you.

Bitte stellen Sie Ihre Fragen auf Englisch, der offiziellen Sprache dieses Forums. Danke schön.

Sorry. Done.

1 Like

Try running your get_forecasts in Developer Tools → Services and post the output. It looks correct so I’m wondering if the name of the result DICT is incorrect or if you are missing data there.

I did. Looks like this:

- condition: rainy
datetime: “2024-05-23T10:00:00+00:00”
wind_bearing: 289.5
temperature: 19.2
templow: 14.5
wind_speed: 11.9
precipitation: 0.6
humidity: 63

Check it now, I ran your exact setup and it works fine except you have it set to trigger once per hour. I set mine to once per minute so I could see the results much quicker and it is fine. For yours, you have to wait an hour after reloading your templates, until then it’s going to be unknown and/or blank:

I found my mistake. It has to be “sensor:” and not “- sensor:”
Wow. It took me hours to get that.

1 Like