Get todays weather forecast

I have automations that need the current weather forecast high and low temps from an entity. This was working great as a template in the past but stopped working many months ago due to changes in HA. Does anyone have a working path to getting these values into a entity? Despite trying many weather integrations I cannot seem to find a working way to get a high or low value into its own entity. I’ve tried to work through several AI solutions, but they all seem to fail even after they finally understand this must work on the 2026 HA versions and all the changes to weather apis, etc. Its very frustrating that most of the “solutions” seem to jump through a huge number of hoops to get a simple value that is already there. Its just seems like I’m missing something basic here.

My weather.home entity provided by openmeteo seems to have the forecast when I create a card for it, how can I get the high and low into distinct entities?

That change was made in 2023… :sweat_smile:

If your preferred weather source integration does not break forecast values out into their own entities, you will need to use the weather.get_forecasts action in a trigger-based template sensor to do it yourself. The core Weather integration docs show a basic example… Integrations - Weather - Examples - Example template sensor using get_forecasts.

Or, you can search these forums for the weather.get_forecasts action… there are dozens of threads covering this topic from nearly every possible angle. Then, if you get stuck, post what you tried and we’ll help sort it out.

1 Like

Thanks for the reply! I’ve been trying to get this to work for a very long time now and guess I’m just lost on how this works. Examples in the forums that seem similar to what I want use older techniques that may be no longer supported.
Here is what I’ve done today:
I removed everything I’ve tried and re-setup openweathermap with my 3.0 api key and it is getting data, the entity is: weather.openweathermap

I then setup an automation to run the weather.get_forecasts action on that entity and store it in “daily” from the way I understand it so far:

alias: Get Weather Forecast
description: ""
triggers:
  - trigger: time_pattern
    minutes: /10
conditions: []
actions:
  - action: weather.get_forecasts
    metadata: {}
    data:
      type: daily
    response_variable: daily
    target:
      entity_id: weather.openweathermap
mode: single

After that, I tried to test with the template editor in dev tools to see if there is data available but it doesnt return any data:

{{ daily['weather.openweathermap'].forecast[0].temperature }}

returns: UndefinedError: ‘daily’ is undefined

Is there a way to see all the data that may be getting stored into “daily”?

I’m not sure this example is good or even the format, but it seemed to work late last year for the person that posted it, so seems like it should work for me. I’m a novice at all this and probably need to better understand whats actually happening.

The Template Editor has no connection to your automation… if you want to test in the Template Editor, you need to provide it the response data manually using a set statement. The best way to do this is to use the Action tool. After you run the action, the response will be available, and there is button at the bottom to copy it in the required format to paste it into the Template editor

Oh, great! Now I know how to test that the call returns forecast least! I get the following data from the action (hopefully the automation above is getting the same):

weather.openweathermap:
  forecast:
    - datetime: "2026-03-02T18:00:00+00:00"
      condition: cloudy
      temperature: 84
      templow: 63
      pressure: 30.03
      cloud_coverage: 58
      wind_speed: 13.24
      wind_bearing: 144
      uv_index: 7.47
      precipitation_probability: 0
      precipitation: 0
      dew_point: 62
      wind_gust_speed: 28.34
      humidity: 58

but my template doesnt seem to have the data, perhaps I’m wrong on the syntax?

template:
  - sensor:
    - name: OpenWeatherMap Forecast Temperature High
      unique_id: openweathermap_forecast_temperature_high
      state: "{{ daily['weather.openweathermap'].forecast[0].temperature }}"
      unit_of_measurement: °F
      device_class: temperature

image

You need to add the trigger and action to the Template sensor configuration… as shown in the example I linked previously.

Ah, is that because you cannot “store” the values, it has to be fed directly?
Here is what I setup but it still has unknown for data:

template:
  - trigger:
      - trigger: time_pattern
        hours: /1
    action:
      - action: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.openweathermap
        response_variable: daily
    sensor:
      - name: OpenWeatherMap Forecast Temperature High
        unique_id: openweathermap_forecast_temperature_high
        state: "{{ daily['weather.openweathermap'].forecast[0].temperature }}"
        unit_of_measurement: °F
        device_class: temperature

I guess that’s one way to describe it. The variables’ scope are local to the automation or template entity where they are configured/created.

The trigger has not fired…

1 Like

That worked, thanks SO MUCH for your help! I added another trigger for homeassistant start and that fixed it. I wonder how many times I dismissed a good config due to that!

That, I can’t answer… :upside_down_face: