Isn’t it nice to be able to get tomorrow’s weather forecast on your mobile every night? This is very simple automation, which takes you 2 minutes to set up in Home Assistant.
To find out what tomorrow’s weather forecast will be, we will use the yr.no integration. This is standard in Home Assistant. The entity is called weather.home, and contains data for the weather right now and the days ahead.
To retrieve the information in weather.home, we need to read the attributes of this entity. We do this by using “state_attr” in our automation. Here we read both “condition” and “temperature” to send this to the mobile phone using the Notify service.
If we use the following code in the message:
Tomorrow’s weather forecast {{state_attr (“weather.home”, “forecast”) [0] .condition}}. It will be around {{state_attr (“weather.home”, “forecast”) [0] .temperature}} degrees during the day.
Then we get tomorrow’s weather and tomorrow’s temperature in the message.
The trigger for this automation is “Time”. For example. then you can set it to run every night at 21:00.
The entire code for this automation will then be
alias: Weather forecast tomorrow
description: Send tomorrow's weather forecast for everyone
trigger:
- platform: time
at: '21: 00 '
condition: []
action:
- service: notify.notify
data:
title: Good evening
message:> -
Tomorrow's weather forecast is {{state_attr ("weather.home", "forecast")
[0] .condition}}. It's going to be around {{state_attr ("weather.home"),
"forecast") [0] .temperature}} ° C during the day.
mode: single