Absolutely stuck trying to setup Frost/Freeze alerts

I’m really new to Home Assistant, but I’ve been trying desperately to setup frost/freeze alerts and I’ve had zero success whatsoever.

I have AccuWeather and OpenWeatherMap integrations setup/configured and working.

I can go to Developer Tools > Actions, and perform a Weather: Get forecasts using the AccuWeather API, and I can see the forecast in the response below.

I’d like to somehow say “check ‘templow’ and if it’s <35, then send an alert.”

For the life of me, I can’t figure out how to do this. I think I need create a sensor and then something from there, but I haven’t been able to create a working sensor. I’m absolutely stuck.

Any help would be appreciated.

hi, I recently saw a blueprint for this…found it, maybe worth a try.

Thanks for the recommendation. Not at all how I wanted to do it, but it may work in the short term until I can figure it out on my own.

I’m not using either of those integrations, but it might be that your templow is an attribute. You may be running in to issues because you’re diving in to something a bit more advanced as a newbie - but it should be possible so keep trying.

I have a “freeze prevention” automation I set up for my sprinkler system that I can run during the sprint-fall if the temp might dip a bit low (it cycles the sprinklers every 15 minutes for a bit to ensure the water doesn’t have a chance to freeze in the lines). This is the relevant bit for you:

conditions:
  - condition: template
    value_template: "{{ state_attr('weather.forecast_home', 'temperature') <= 1 }}"

Easiest way would be to go to the “Developer tools” section, go to the “States” tab and then filter to your AccuWeather entity and look at the attributes it has. Make note of the name of whatever you need, and then that would go in to the state_attr() function call (entity id, attribute).

Hopefully that pushes you in the right direction.

Hey, I wrote the blueprint linked above. I specifically wrote it for the purpose of alerting me when temps would get below freezing overnight. It sounds like it’d do what you need it to do, just by setting Minimum Temperature Threshold to 35, setting the weather entity to your accuweather entitiy, and disabling all the other conditions that you don’t care to be notified of, e.g.:

Or am I misinterpreting what you mean, and you just meant that you’d rather not use a blueprint to achieve this, and instead just write out an automation manually?

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:
Open your Home Assistant instance and show your service developer tools with a specific action selected.

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:
Open your Home Assistant instance and show your template developer tools.

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.
Open your Home Assistant instance and show your automations.

You’ll want it to trigger at some specific time, and perform the following actions:

  1. Get hourly forecast (set response variable to action_response like we had already used in our scratch template)
  2. Define variables (optional)
  3. Check Template Condition (is min temperature lower than your desired threshold? Stop if not.)
  4. 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.