Every garden owner will know the problem: Winter is coming.

There are many things in the garden that should be switched off or prepared accordingly before the first frost, as otherwise they will be damaged and therefore need to be properly winterized. This also applies to my garden irrigation and all other things.
Preparations 🛠️
In order to know when the first frost is coming, you need to prepare a few things. This includes creating a sensor that queries precisely this data and determines it as a Boolean value. Accordingly, the sensor can accept the value true or false.
To do this, we create a new template sensor in our configuration.yaml. The template sensor queries the data of the Weather entity and calculates whether the temperature at the specified location falls below 0°C and if so, for how long.
In addition, the attributes also store what the lowest temperature is and when (i.e. on which date) it occurs.
Please remember to adapt the CHANGE THIS to your circumstances:
- platform: template
sensors:
frost_warning:
friendly_name: "frost warning"
unique_id: "39a5e512-b92f-449c-b681"
icon_template: "mdi:snowflake-alert"
value_template: >-
{% if states('sensor.min_temp_forecast') | float < 0 %}
on
{% else %}
off
{% endif %}
attribute_templates:
frostdays: >-
{% set ns = namespace(frostdays=0) %}
{%- for fc in states.weather.CHANGE THIS.attributes.forecast -%}
{%- if fc.templow < 0 -%}
{%- set ns.frostdays = ns.frostdays + 1 -%}
{%- endif -%}
{%- endfor -%}
{{ns.frostdays}}
first_frost_date: >-
{% set ns = namespace(date=0) %}
{%- for fc in states.weather.CHANGE THIS.attributes.forecast -%}
{%- if fc.templow < 0 and ns.date == 0 -%}
{%- set ns.date = fc.datetime -%}
{%- endif -%}
{%- endfor -%}
{{ns.date}}
date_low: "{{state_attr('sensor.min_temp_forecast', 'datetime')}}"
temp_low: "{{states('sensor.min_temp_forecast')}}"
forecastdays: "{{state_attr('sensor.min_temp_forecast', 'forecastdays')}}"In order for the forecast to be fetched correctly, the Weather entity must be configured. You can easily do this with the following instructions:


Winter is coming, the automation ☃️
With the created sensor, we can therefore determine whether and, above all, when exactly and for how long it will freeze. We can then be notified or other things can be triggered automatically. You can use the following automation for this:
alias: "Frost Warning: Send Notification"
description: >-
If frost is forecast in the weather forecast, then send out a notification
so that the water is turned off.
trigger:
- platform: state
entity_id: sensor.frost_warning
from: "off"
to: "on"
condition: []
action:
- service: notify.notify
data:
title: Winter is coming!
message: >-
From {{ as_timestamp(state_attr("sensor.frost_warning",
"first_frost_date")) | timestamp_custom("%a, %d.%m.%y", True) }} it should
freeze with temperatures up to {{ state_attr('sensor.frost_warning',
'temp_low') }}°C on {{state_attr('sensor.frost_warning', 'frostdays') }}
days in the coming {{state_attr('sensor.frost_warning',
'forecastdays') }} days.
data:
priority: 1
mode: singleAnd from now on you will be notified when frost sets in 😊
Jon Schnee would be proud of you (or maybe not, because he no longer has to stand guard) 👏

Why frost warnings matter
Frost can cause significant damage in the garden and around the house: Sensitive plants freeze, water pipes can burst, and outdoor faucets are particularly at risk. A timely warning gives you the opportunity to take preventive measures – or have Home Assistant handle them automatically.
Advanced frost automations
Beyond a simple notification, you can link the frost warning to additional actions: automatically closing irrigation valves, turning on frost protection heating in the greenhouse, or activating underfloor heating in the entrance area to prevent icy conditions. Combined with DWD weather warnings, you can even react proactively before frost actually sets in.
Further reading
If you enjoyed this article, you might also find these interesting:
Discover more articles
Frost-Warnung mit Home Assistant 🥶
Du hast einen Garten und möchtest benachrichtigt werden, wenn der Winter kommt? Ich zeig dir wie einfach es geht 🏡
Nicht smarte Geräte überwachen 💡
Wie du relativ simpel normale Geräte smart machen kannst, zeige ich dir in dem Artikel ☝️
DWD weather warnings: Smart integration with HACS ⛈️
Learn how to integrate weather warnings from the DWD into Home Assistant and be informed in good time when warnings are issued! ⛈️
WebNUT: Integrate UPS into the SmartHome
Learn how to install and configure WebNUT in Docker and integrate it into HomeAssistant to monitor your UPS devices in your smart home. 🏠
Switch on 3D printer when slicer is opened
Today I'll show you how you can automatically switch on your 3D printer when you start your slicer software on your computer ✨
Automate Home Assistant with WebHooks
Firing automations in Home Assistant through external systems 🚀 Let me show you how to do it!
