Yes. We’re going to have to get quite advanced here: due to a recent change, there are some steps to take to be able to access weather forecasts like you need to.
First of all, do you actually have a weather.home entity set up, or is that something that ChatGPT hallucinated?
If you do not, you’ll have to find and install a suitable weather integration for your location. Once you’ve done that, and assuming you’ve called it weather.home…
You’ll need to add this code to your configuration:
template:
- trigger:
- platform: time_pattern
hours: /1
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather forecast
state: "{{ now() }}"
attributes:
- forecast: "{{ hourly['weather.home'].forecast }}"
Have a look in your configuration.yaml file (help). Do you already have a line like this or similar?
template: !include templates.yaml
If you do, then the code above goes into the referenced file (templates.yaml in my example here) without the first template: line.
If you do not, you can put the code straight into configuration.yaml, but make sure there’s only one template: line in the file.
Restart HA, and see if you have a sensor called sensor.weather_forecast. If you do, paste this into Developer Tools / Template and paste the first few lines of the result here formatted like your original automation code:
{{ states['sensor.weather_forecast'] }}
The result should look something like this:
<template TemplateState(<state sensor.weather_forecast'=2024-05-15T04:00Z; timeSeries=[{'time': '2024-05-13T00:00Z', 'midnight10MWindSpeed': 4.12, 'midnight10MWindDirection': 126, 'midnight10MWindGust': 9.26, 'midnightVisibility': 4698, 'midnightRelativeHumidity': 93.86, 'midnightMslp': 100100, 'nightMinScreenTemperature': 13.41, 'nightUpperBoundMinTemp': 14.23, 'nightLowerBoundMinTemp': 12.15, 'nightUpperBoundMinFeelsLikeTemp': 12.76, 'nightLowerBoundMinFeelsLikeTemp': 11.36}, {'time': '2024-05-14T00:00Z', 'midday10MWindSpeed': 5.35, 'midnight10MWindSpeed': 3.6, 'midday10MWindDirection': 138, 'midnight10MWindDirection': 104, 'midday10MWindGust': 7.2, 'midnight10MWindGust': 8.23, 'middayVisibility': 14182, 'midnightVisibility': 11172, 'middayRelativeHumidity': 81.02, 'midnightRelativeHumidity': 91.4, 'middayMslp': 99950, 'midnightMslp': 100250, 'maxUvIndex': 3, 'daySignificantWeatherCode': 7, 'nightSignificantWeatherCode': 12, 'dayMaxScreenTemperature': 17.22, 'nightMinScreenTemperature': 12.59, 'dayUpperBoundMaxTemp': 18.33, 'nightUpperBoundMinTemp': 13.64,
Once we have that working, we can move onto the automation.