As stated in the previous post of this series, the notification is missing one thing: taking the forecast into account. This feature would be good because if the weather is dropping down to 52F during the night I do not want to be opening the windows. My current solution is to double the weather on my phone, but it would be nice to have this automated.
Problem
The National Weather Service Integration doesn’t actually have an assessable forecast entity, but the lovelace card shows it so I know the data is there.
My first step is checking the states in the Developer Tools section. This is what I
see for the weather.kmop_daynight
entity:
|
|
Playing around with the template section in the Developer Tools section I have come up
with this, {{ state_attr("weather.kmop_daynight", "forecast") }}
, which has the output
of:
|
|
From what I can see with this output is that
- daynight is to determine if it’s a Night forecast
- The future items are at 6AM and 6PM.
- The first item seems to be closer to the current time’s forecast and not 6AM/PM
The Entity
Note: See the edited and final version at the bottom of this post
My first idea is this {{ state_attr("weather.kmop_daynight", "forecast").1.temperature }}
,
Which would be the simplest way of accomplishing what I want.
A quick reload later and the entity exists!
Main Automation Change
I’ve added a new condition for the Main Automation created in the previous post
Condition, Numerical State
- Entity: sensor.forecast_temperature_template
- Above:
- Fixed Number
- 62
- Below: blank
Updated Raw YAML in Another Main Automation Change
The Updated Entity
When the clock hits 6PM the next forecast element is the next day’s 6AM, This will not work because the next day’s 6AM isn’t the projected temp at 6AM, but the high for that day.
This is the updated version that picks the different forecasts depending on the day; 18 being 6PM in 24-hour time
|
|
Another Main Automation Change
After real world use, and weirdly cold nights in Michigan, I’ve noticed the behavior
that the National Weather Service isn’t reliably updating the forecast at 6pm. Instead
of adding more complexity to the forecast_temperature_template
entity, I will skip the
6PM check.
To do this I will replace the Time Pattern trigger with hardcoded times and the Time trigger, This will also remove the 4:30pm-11:59pm time condition. I was avoiding this because it would be a lot of fields to enter, but I’m going to write it in YAML
Trigger: Time
- click 3 dots + Edit in YAML
- Paste contents of code block
|
|