Closed Doa132 closed 3 months ago
I think this is just you. Please reopen if you disagree.
Can we get a link to where this is explained. I have the same issue.
Not just me and still happening. I tried reverting to a few previous versions (up to 1.2.3) and the issue was still present there. Are you able to access the forecast attributes via template? Or even see them in the Developer states page. If so, can you give an example of a basic working template that shows the first forecast?
Ok I have been trying some things and now have
{{states.sensor.weather_forecast_hourly}}
in Developer Tools - Template giving me data like this
<template TemplateState(<state sensor.weather_forecast_hourly=2024-07-26T13:00:00.207323+10:00; forecast=[{'datetime': '2024-07-26T12:00:00+10:00', 'condition': 'sunny', 'precipitation_probability': 5, 'wind_bearing': 'N', 'wind_gust_speed': 35, 'uv': 1, 'temperature': 14.0, 'wind_speed': 22.0, 'precipitation': 0.0, 'humidity': 61}, {'datetime': '2024-07-26T13:00:00+10:00', 'condition': 'sunny', 'precipitation_probability': 5, 'wind_bearing': 'N', 'wind_gust_speed': 39, 'uv': 2, 'temperature': 15.0, 'wind_speed': 24.0, 'precipitation': 0.0, 'humidity': 55}, {'datetime': '2024-07-26T14:00:00+10:00', 'condition': 'sunny', 'precipitation_probability': 5, 'wind_bearing': 'N', 'wind_gust_speed': 41, 'uv': 2, 'temperature': 16.0, 'wind_speed': 26.0, 'precipitation': 0.0, 'humidity': 53}, {'datetime': '2024-07-26T15:00:00+10:00', 'condition': 'sunny', 'precipitation_probability': 5, 'wind_bearing': 'N', 'wind_gust_speed': 41, 'uv': 2, 'temperature': 16.0, 'wind_speed': 26.0, 'precipitation': 0.0, 'humidity': 52}, {'datetime': '2024-07-26T16:00:00+10:00', 'condition': 'sunny', 'precipitation_probability': 5, 'wind_bearing': 'N', 'wind_gust_speed': 41, 'uv': 1, 'temperature': 16.0, 'wind_speed': 26.0, 'precipitation': 0.0, 'humidity': 53}, {'datetime': '2024-07-26T17:00:00+10:00',
The same data appears in Developer Tools - States with that entity. To get this I have in my config.yaml
template:
- trigger:
- platform: time_pattern
hours: "/1"
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.camberwell_hourly
response_variable: hourly
- variables:
today: "{{ hourly['weather.camberwell_hourly'].forecast[0] }}"
sensor:
- name: "Weather Forecast Hourly"
unique_id: weather_forecast_hourly
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly['weather.camberwell_hourly'].forecast }}"
but using the same format I cannot get daily data to work. I get sensor.weather_forecast_daily Unavailable. And still have gaps in my card data with sensor.camberwell_temp_max_0 even though there is data in that entity.
Thanks. Just had a look and that does work for what I was after. Not sure about your missing card data as I dont use a card like that. Tried adapting to daily with this code and it's working for me.
template:
- trigger:
- platform: time_pattern
minutes: "/1"
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.town
response_variable: daily
- variables:
today: "{{ daily['weather.town'].forecast[0] }}"
sensor:
- name: "Weather Forecast Daily"
unique_id: weather_forecast_daily
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ daily['weather.town'].forecast }}"
I'm not sure if I'm just unable to think of the correct template to display a temperature for a specific hour later in the day, or if this is an issue. But I can't access the hourly forecast temperatures in a template. They show in the weather.[town]_hourly info pop up but not in the Developers Tools -- State set state section. {{states.weather.launceston_hourly{} and {{states.weather.launceston_hourly.attributes}} don't show any clues to lead to them and nor does any other word combination I can think of. Is this an actual issue, or just an issue with me?