If you were looking to figure out how to do it “manually” or might be interested to know how the blueprint works under the hood, here’s how I set it up (also posting for anyone else who comes along and finds this post):
1. Call service to get sample hourly weather forecast
First, go to your Home Assistant Developer Tools and call the weather.get_forecasts
action:
You’ll want to select one of your two weather providers as the entity, and set the type to hourly
:
action: weather.get_forecasts
target:
entity_id: weather.home
data:
type: hourly
Call the service, and you should get an hourly forecast, with 24 entries:
Example output
weather.home:
forecast:
- condition: clear-night
datetime: "2025-01-13T02:00:00+00:00"
wind_bearing: 316.6
cloud_coverage: 0
uv_index: 0
temperature: -8.6
wind_speed: 10.1
precipitation: 0
humidity: 84
- condition: clear-night
datetime: "2025-01-13T03:00:00+00:00"
wind_bearing: 316.1
cloud_coverage: 0
uv_index: 0
temperature: -9.1
wind_speed: 9.7
precipitation: 0
humidity: 86
- condition: clear-night
datetime: "2025-01-13T04:00:00+00:00"
wind_bearing: 315.9
cloud_coverage: 0
uv_index: 0
temperature: -9.5
wind_speed: 9.4
precipitation: 0
humidity: 86
- condition: clear-night
datetime: "2025-01-13T05:00:00+00:00"
wind_bearing: 320.2
cloud_coverage: 3.9
uv_index: 0
temperature: -9.8
wind_speed: 9.4
precipitation: 0
humidity: 87
- condition: clear-night
datetime: "2025-01-13T06:00:00+00:00"
wind_bearing: 324.5
cloud_coverage: 0.8
uv_index: 0
temperature: -10
wind_speed: 9.4
precipitation: 0
humidity: 86
- condition: clear-night
datetime: "2025-01-13T07:00:00+00:00"
wind_bearing: 311.1
cloud_coverage: 0
uv_index: 0
temperature: -10.2
wind_speed: 9.4
precipitation: 0
humidity: 86
- condition: clear-night
datetime: "2025-01-13T08:00:00+00:00"
wind_bearing: 304.9
cloud_coverage: 11.7
uv_index: 0
temperature: -10.4
wind_speed: 9.7
precipitation: 0
humidity: 86
- condition: partlycloudy
datetime: "2025-01-13T09:00:00+00:00"
wind_bearing: 313.5
cloud_coverage: 83.6
uv_index: 0
temperature: -10.6
wind_speed: 9.4
precipitation: 0
humidity: 86
- condition: cloudy
datetime: "2025-01-13T10:00:00+00:00"
wind_bearing: 308.1
cloud_coverage: 100
uv_index: 0
temperature: -10.5
wind_speed: 9.4
precipitation: 0
humidity: 86
- condition: cloudy
datetime: "2025-01-13T11:00:00+00:00"
wind_bearing: 311.9
cloud_coverage: 100
uv_index: 0
temperature: -9.4
wind_speed: 9.4
precipitation: 0
humidity: 83
- condition: cloudy
datetime: "2025-01-13T12:00:00+00:00"
wind_bearing: 316.9
cloud_coverage: 100
uv_index: 0
temperature: -8.3
wind_speed: 7.6
precipitation: 0
humidity: 78
- condition: cloudy
datetime: "2025-01-13T13:00:00+00:00"
wind_bearing: 305.1
cloud_coverage: 100
uv_index: 0.2
temperature: -7.8
wind_speed: 6.8
precipitation: 0
humidity: 76
- condition: cloudy
datetime: "2025-01-13T14:00:00+00:00"
wind_bearing: 279.8
cloud_coverage: 100
uv_index: 0.4
temperature: -6.7
wind_speed: 5.8
precipitation: 0
humidity: 71
- condition: cloudy
datetime: "2025-01-13T15:00:00+00:00"
wind_bearing: 277
cloud_coverage: 100
uv_index: 0.8
temperature: -5.2
wind_speed: 4.3
precipitation: 0
humidity: 66
- condition: cloudy
datetime: "2025-01-13T16:00:00+00:00"
wind_bearing: 258.7
cloud_coverage: 100
uv_index: 1
temperature: -3.7
wind_speed: 6.5
precipitation: 0
humidity: 60
- condition: cloudy
datetime: "2025-01-13T17:00:00+00:00"
wind_bearing: 261.9
cloud_coverage: 95.3
uv_index: 1
temperature: -2.7
wind_speed: 8.6
precipitation: 0
humidity: 59
- condition: cloudy
datetime: "2025-01-13T18:00:00+00:00"
wind_bearing: 258.8
cloud_coverage: 99.2
uv_index: 0.8
temperature: -2.5
wind_speed: 9
precipitation: 0
humidity: 59
- condition: cloudy
datetime: "2025-01-13T19:00:00+00:00"
wind_bearing: 260.4
cloud_coverage: 97.7
uv_index: 0.4
temperature: -2.6
wind_speed: 8.6
precipitation: 0
humidity: 60
- condition: cloudy
datetime: "2025-01-13T20:00:00+00:00"
wind_bearing: 264.5
cloud_coverage: 99.2
uv_index: 0.1
temperature: -2.9
wind_speed: 7.6
precipitation: 0
humidity: 61
- condition: partlycloudy
datetime: "2025-01-13T21:00:00+00:00"
wind_bearing: 264.4
cloud_coverage: 63.3
uv_index: 0
temperature: -3.8
wind_speed: 5.4
precipitation: 0
humidity: 67
- condition: partlycloudy
datetime: "2025-01-13T22:00:00+00:00"
wind_bearing: 289.6
cloud_coverage: 17.2
uv_index: 0
temperature: -5.6
wind_speed: 5.4
precipitation: 0
humidity: 75
- condition: clear-night
datetime: "2025-01-13T23:00:00+00:00"
wind_bearing: 312.3
cloud_coverage: 9.4
uv_index: 0
temperature: -6.3
wind_speed: 6.5
precipitation: 0
humidity: 74
- condition: partlycloudy
datetime: "2025-01-14T00:00:00+00:00"
wind_bearing: 325.2
cloud_coverage: 38.3
uv_index: 0
temperature: -7.2
wind_speed: 6.8
precipitation: 0
humidity: 76
- condition: clear-night
datetime: "2025-01-14T01:00:00+00:00"
wind_bearing: 344.4
cloud_coverage: 6.2
uv_index: 0
temperature: -8.1
wind_speed: 6.8
precipitation: 0
humidity: 80
2. Set response as variable in template editor
Click the button at the bottom of the screen labeled Copy to Clipboard (Template)
.
Then, navigate to the Template page in your Home Assistant Developer Tools, clear any existing template, and then paste the contents of your clipboard:
This will set a variable in the environment called action_response
(conveniently, this is the default variable name where the result would be set if this action were called from within an automation… we’ll come back to this).
Example pasted content
{% set action_response = {"weather.home":{"forecast":[{"condition":"clear-night","datetime":"2025-01-13T02:00:00+00:00","wind_bearing":316.6,"cloud_coverage":0,"uv_index":0,"temperature":-8.6,"wind_speed":10.1,"precipitation":0,"humidity":84},{"condition":"clear-night","datetime":"2025-01-13T03:00:00+00:00","wind_bearing":316.1,"cloud_coverage":0,"uv_index":0,"temperature":-9.1,"wind_speed":9.7,"precipitation":0,"humidity":86},{"condition":"clear-night","datetime":"2025-01-13T04:00:00+00:00","wind_bearing":315.9,"cloud_coverage":0,"uv_index":0,"temperature":-9.5,"wind_speed":9.4,"precipitation":0,"humidity":86},{"condition":"clear-night","datetime":"2025-01-13T05:00:00+00:00","wind_bearing":320.2,"cloud_coverage":3.9,"uv_index":0,"temperature":-9.8,"wind_speed":9.4,"precipitation":0,"humidity":87},{"condition":"clear-night","datetime":"2025-01-13T06:00:00+00:00","wind_bearing":324.5,"cloud_coverage":0.8,"uv_index":0,"temperature":-10,"wind_speed":9.4,"precipitation":0,"humidity":86},{"condition":"clear-night","datetime":"2025-01-13T07:00:00+00:00","wind_bearing":311.1,"cloud_coverage":0,"uv_index":0,"temperature":-10.2,"wind_speed":9.4,"precipitation":0,"humidity":86},{"condition":"clear-night","datetime":"2025-01-13T08:00:00+00:00","wind_bearing":304.9,"cloud_coverage":11.7,"uv_index":0,"temperature":-10.4,"wind_speed":9.7,"precipitation":0,"humidity":86},{"condition":"partlycloudy","datetime":"2025-01-13T09:00:00+00:00","wind_bearing":313.5,"cloud_coverage":83.6,"uv_index":0,"temperature":-10.6,"wind_speed":9.4,"precipitation":0,"humidity":86},{"condition":"cloudy","datetime":"2025-01-13T10:00:00+00:00","wind_bearing":308.1,"cloud_coverage":100,"uv_index":0,"temperature":-10.5,"wind_speed":9.4,"precipitation":0,"humidity":86},{"condition":"cloudy","datetime":"2025-01-13T11:00:00+00:00","wind_bearing":311.9,"cloud_coverage":100,"uv_index":0,"temperature":-9.4,"wind_speed":9.4,"precipitation":0,"humidity":83},{"condition":"cloudy","datetime":"2025-01-13T12:00:00+00:00","wind_bearing":316.9,"cloud_coverage":100,"uv_index":0,"temperature":-8.3,"wind_speed":7.6,"precipitation":0,"humidity":78},{"condition":"cloudy","datetime":"2025-01-13T13:00:00+00:00","wind_bearing":305.1,"cloud_coverage":100,"uv_index":0.2,"temperature":-7.8,"wind_speed":6.8,"precipitation":0,"humidity":76},{"condition":"cloudy","datetime":"2025-01-13T14:00:00+00:00","wind_bearing":279.8,"cloud_coverage":100,"uv_index":0.4,"temperature":-6.7,"wind_speed":5.8,"precipitation":0,"humidity":71},{"condition":"cloudy","datetime":"2025-01-13T15:00:00+00:00","wind_bearing":277,"cloud_coverage":100,"uv_index":0.8,"temperature":-5.2,"wind_speed":4.3,"precipitation":0,"humidity":66},{"condition":"cloudy","datetime":"2025-01-13T16:00:00+00:00","wind_bearing":258.7,"cloud_coverage":100,"uv_index":1,"temperature":-3.7,"wind_speed":6.5,"precipitation":0,"humidity":60},{"condition":"cloudy","datetime":"2025-01-13T17:00:00+00:00","wind_bearing":261.9,"cloud_coverage":95.3,"uv_index":1,"temperature":-2.7,"wind_speed":8.6,"precipitation":0,"humidity":59},{"condition":"cloudy","datetime":"2025-01-13T18:00:00+00:00","wind_bearing":258.8,"cloud_coverage":99.2,"uv_index":0.8,"temperature":-2.5,"wind_speed":9,"precipitation":0,"humidity":59},{"condition":"cloudy","datetime":"2025-01-13T19:00:00+00:00","wind_bearing":260.4,"cloud_coverage":97.7,"uv_index":0.4,"temperature":-2.6,"wind_speed":8.6,"precipitation":0,"humidity":60},{"condition":"cloudy","datetime":"2025-01-13T20:00:00+00:00","wind_bearing":264.5,"cloud_coverage":99.2,"uv_index":0.1,"temperature":-2.9,"wind_speed":7.6,"precipitation":0,"humidity":61},{"condition":"partlycloudy","datetime":"2025-01-13T21:00:00+00:00","wind_bearing":264.4,"cloud_coverage":63.3,"uv_index":0,"temperature":-3.8,"wind_speed":5.4,"precipitation":0,"humidity":67},{"condition":"partlycloudy","datetime":"2025-01-13T22:00:00+00:00","wind_bearing":289.6,"cloud_coverage":17.2,"uv_index":0,"temperature":-5.6,"wind_speed":5.4,"precipitation":0,"humidity":75},{"condition":"clear-night","datetime":"2025-01-13T23:00:00+00:00","wind_bearing":312.3,"cloud_coverage":9.4,"uv_index":0,"temperature":-6.3,"wind_speed":6.5,"precipitation":0,"humidity":74},{"condition":"partlycloudy","datetime":"2025-01-14T00:00:00+00:00","wind_bearing":325.2,"cloud_coverage":38.3,"uv_index":0,"temperature":-7.2,"wind_speed":6.8,"precipitation":0,"humidity":76},{"condition":"clear-night","datetime":"2025-01-14T01:00:00+00:00","wind_bearing":344.4,"cloud_coverage":6.2,"uv_index":0,"temperature":-8.1,"wind_speed":6.8,"precipitation":0,"humidity":80}]}} %}
3. Extract data of interest from variable
Now that you have a sample forecast response in the template editor you can test different templates that you will use in your automations. Because the response object is pretty large, I’d recommend breaking it down by extracting the parts you need and setting them as variables, like this:
{% set num_hours=8 %}
{% set next_8_hours = action_response['weather.home']['forecast'][:num_hours] %}
{% set temps = next_8_hours | map(attribute='temperature') | list %}
This will ultimately set the temps
variable to something that looks like this:
[-8.6, -9.1, -9.5, -9.8, -10, -10.2, -10.4, -10.6]
Then you can get the minimum temperature using {{ temps | min }}
.
This template:
{% set action_response = ...same as above... %}
{% set num_hours=8 %}
{% set next_8_hours = action_response['weather.home']['forecast'][:num_hours] %}
{% set temps = next_8_hours | map(attribute='temperature') | list %}
Temps: {{ temps }}
Max Temp: {{ temps | max }}
Min Temp: {{ temps | min }}
Temps dipped below -5?: {{ temps | min < -5 }}
Temps dipped below -15?: {{ temps | min < -15 }}
renders as:
Temps: [-8.6, -9.1, -9.5, -9.8, -10, -10.2, -10.4, -10.6]
Max Temp: -8.6
Min Temp: -10.6
Temps dipped below -5?: True
Temps dipped below -15?: False
NOTE: You don’t have to set all of these intermediate variables, but it makes it a lot easier to read and troubleshoot when things aren’t looking right. You could do this in one line using something like this:
Temps below -5: {{ action_response['weather.home']['forecast'][:num_hours] | map(attribute='temperature') | min < -5 }}
4. Write automation
Now that we’ve tested calling the action and parsing the response, it’s pretty easy to set up in an automation.
You’ll want it to trigger at some specific time, and perform the following actions:
- Get hourly forecast (set response variable to
action_response
like we had already used in our scratch template)
- Define variables (optional)
- Check Template Condition (is min temperature lower than your desired threshold? Stop if not.)
- Send mobile app notification with desired text
In YAML this might look like:
description: ""
mode: single
triggers: []
conditions: []
actions:
- action: weather.get_forecasts
metadata: {}
data:
type: hourly
response_variable: action_response
target:
entity_id: weather.home
- variables:
min_temp: >-
{{ action_response['weather.home']['forecast'][:num_hours] |
map(attribute='temperature') | min }}
- condition: template
value_template: "{{ min_temp < -5 }} "
- action: notify.mobile_app_my_phone
metadata: {}
data:
message: Temps will reach a minimum of {{ min_temp }} tonight!
title: Low Temp Alert
Add your own triggers, change the notification target, adjust the thresholds to your own liking, set different variables if you wish, etc.