I have been lackadaisical with my Home Assistant updates, but when
I updated it late December of 2024 I’ve broken all my forecast
automations. I had for a short while swapped to openweathermap, but now
that even seems to be broken. With summer heat at an all time peak I
would like to get this working again. I’ve moderate research on this…
and it’s a nightmare. As of writing my instance is 2025.6.2
Problem
{{ state_attr("weather.kmop_daynight", "forecast") }}
has now been
deprecated and now you have to manually call to get the forecast.
From the 3-4 threads I have read, this requires a template, with a
trigger and an action. The major problem right off the bat was testing
anything. The forums described “Developer Tools” and the “Services”
tab, I don’t have any of that.
Testing
After plenty of failures, “Services” has now been renamed to “Actions”. Going there a simple test is:
- Select
weather.get_forecasts
in the search - Select the
KMOP
entity - Forecast Type:
Twice Daily
This is the YAML for the call
Clicking to preform action outputs it in this format
Scrolling down you can click the COPY TO CLIPBOARD (TEMPLATE)
button
and this data can then be used inside the Template tab. This is also
where you see that the response_variable is in fact being set to
response
Automating
This is where the template part comes in. I created a new file templates.yaml
and added this line template: !include templates.yaml
in my main configuration
I’ve found this file was specific on action
and sensor
not having a dash
1- trigger:
2 - platform: time_pattern
3 minutes: "/15"
4 action:
5 - service: weather.get_forecasts
6 data:
7 type: twice_daily
8 target:
9 entity_id: weather.kmop_daynight
10 response_variable: response
11 sensor:
12 - name: Weather Forecast
13 unique_id: weather_forecast
14 state: "{{ now() }}"
15 attributes:
16 forecast: "{{ response['weather.kmop_daynight'].forecast }}"
After creating this and resetting Home Assistant this new sensor appeared as
unknown
. I am hoping that it will configure after 15 minutes.
Which happened!
Converting
Now to update the entity created in the previous post
|
|
I had added an “unavailable” if to all my templates to avoid error logs
Next
My current plans is to keep this running for a week or two to check
that it’s working and then changed the trigger to a time
platform. This would
lower the amount of requests.