This must have been asked before, but my search skills have failed me.
Weather.home provides the following information:-
temperature: 6.5
temperature_unit: °C
humidity: 77
pressure: 990.2
pressure_unit: hPa
wind_bearing: 227.6
wind_speed: 13.3
wind_speed_unit: km/h
visibility_unit: km
precipitation_unit: mm
forecast:
- condition: partlycloudy
datetime: '2023-01-09T12:00:00+00:00'
wind_bearing: 290.9
temperature: 8.2
templow: 4.6
wind_speed: 33.1
precipitation: 0
- condition: rainy
datetime: '2023-01-10T12:00:00+00:00'
wind_bearing: 219.5
temperature: 12.9
templow: 4.9
wind_speed: 30.2
precipitation: 8.5
- condition: rainy
datetime: '2023-01-11T12:00:00+00:00'
wind_bearing: 240
temperature: 8.5
templow: 6.8
wind_speed: 31.7
precipitation: 0.6
- condition: rainy
datetime: '2023-01-12T12:00:00+00:00'
wind_bearing: 232.8
temperature: 11.7
templow: 8.4
wind_speed: 29.9
precipitation: 12.2
- condition: cloudy
datetime: '2023-01-13T12:00:00+00:00'
wind_bearing: 242.4
temperature: 10.1
templow: 7.3
wind_speed: 19.4
precipitation: 0.4
attribution: >-
Weather forecast from met.no, delivered by the Norwegian Meteorological
Institute.
friendly_name: Forecast Home
Using states() and state_attr() I can easily get the top level attributes, but how would I get to the data in the forecast array.
When using (in dev tools):-
{{state_attr('weather.forecast_home','forecast')}}
returns a json array:-
[{'condition': 'partlycloudy', 'datetime': '2023-01-09T12:00:00+00:00', 'wind_bearing': 290.9, 'temperature': 8.2, 'templow': 4.6, 'wind_speed': 33.1, 'precipitation': 0.0}, {'condition': 'rainy', 'datetime': '2023-01-10T12:00:00+00:00', 'wind_bearing': 219.5, 'temperature': 12.9, 'templow': 4.9, 'wind_speed': 30.2, 'precipitation': 8.5}, {'condition': 'rainy', 'datetime': '2023-01-11T12:00:00+00:00', 'wind_bearing': 240.0, 'temperature': 8.5, 'templow': 6.8, 'wind_speed': 31.7, 'precipitation': 0.6}, {'condition': 'rainy', 'datetime': '2023-01-12T12:00:00+00:00', 'wind_bearing': 232.8, 'temperature': 11.7, 'templow': 8.4, 'wind_speed': 29.9, 'precipitation': 12.2}, {'condition': 'cloudy', 'datetime': '2023-01-13T12:00:00+00:00', 'wind_bearing': 242.4, 'temperature': 10.1, 'templow': 7.3, 'wind_speed': 19.4, 'precipitation': 0.4}]
So if I wanted to extract for example, the high and low temperature for the day, or if any of the forecast array elements contained rain ?
The idea is to extend my morning TTS to provide this information, which already does:-
Good Morning! The temperature is outside currently
{{state_attr('weather.forecast_home','temperature')}} degrees, and the
weather is forecast to be {{states('weather.forecast_home')}}