Weather Forecast in Home Assistant
What to do, if
{{ state_attr('weather.openweathermap', 'forecast') }}
{{ state_attr('weather.home, 'forecast') }}
only return null ?
First, test
service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.openweathermap # or weather.home
in Homeassistant dev tools/serices YAML Mode if you see forecast results.
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
# type hourly gibt einem für alle drei stunden einen forecast zurück
type: hourly
target:
entity_id: weather.openweathermap
response_variable: hourly
sensor:
- name: Temperature forecast in 3h
unique_id: temperature_forecast_next_hour
state: "{{ hourly['weather.openweathermap'].forecast[0].temperature }}"
unit_of_measurement: °C
attributes:
temperature: "{{ hourly['weather.openweathermap'].forecast[0].temperature }}"
datetime: "{{ hourly['weather.openweathermap'].forecast[0].datetime }}"
humidity: "{{ hourly['weather.openweathermap'].forecast[0].humidity }}"
based on How To Use Hourly Forecast Information (Since 2024.3.0)
Article relase date:
/
Last update: