this one’s driving me crazy, and I can’t figure it out. I’m trying to create a sensor for the forecasted temperature for now. My sensors are all returning unavailable. Here’s what I’ve got so far:
when I run:
service: weather.get_forecasts
target:
entity_id:
- weather.openweathermap
data:
type: hourly
I get back:
weather.openweathermap:
forecast:
- condition: sunny
precipitation_probability: 0
datetime: "2024-09-04T15:00:00+00:00"
wind_bearing: 89
cloud_coverage: 0
temperature: 68
pressure: 30.42
wind_speed: 4.36
precipitation: 0
humidity: 51
- condition: sunny
precipitation_probability: 0
datetime: "2024-09-04T18:00:00+00:00"
wind_bearing: 106
cloud_coverage: 0
temperature: 74
pressure: 30.39
wind_speed: 4.29
precipitation: 0
humidity: 40
(and several more, but for this purpose, I’ll only use the first two)
But, this template sensor returns unavailable and no attribute:
template:
- trigger:
- platform: time_pattern
hours: /1
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.openweathermap
response_variable: hourly
sensor:
- name: Temperature forecast +1 hour
unique_id: temperature_forecast_1_hours
state: "{{ hourly['weather.openweathermap'].forecast[0].temperature }}"
attributes:
time: >
"{{ hourly['weather.openweathermap'].forecast[0].datetime }}"
I’m sure there’s something silly I’m missing, and hopefully someone can spot it easily. Thanks in advance!