Hi. Is threre any way to make sensor that would show Accuweather Forecast condition for next day only?
You can use a templaye sensor for this purpose. Just try this.
sensor:
- platform: template
sensors:
weather_forecast:
friendly_name: "Weather Forecast"
value_template: "{{ state_attr('weather.accuweather', 'forecast')[0]['condition'] }}"
Please change the entity_id according to your accuweather entity id
Awesome!! Thank You. Can I extract the same way forcasted temp?
yes, just change the value template accordingly
Superb,thank You
One more question. What that [0] mean? Should I for ex. Change it to 1 if I want to show different day of forecast? 1 = day after tomorrow?
Thank You
0 refers to the first object under the title forecast which is the attributes of tomorrows weather forecast. If you use 1 then it will select the second object under forecast that will be the forecast for day after tomorrow. Like wise it continues…
Thank you, you have helped me alot
Hi @sheminasalam I’ve followed your tips above but I’m getting these errors in my logs even though the sensor displays fine in my lovelace, do you know how to get rid of the errors?
TemplateError('UndefinedError: None has no element 1') while processing template 'Template("{{ state_attr('weather.42_pine', 'forecast') [1]['precipitation_probability'] }}")' for attribute '_attr_native_value' in entity 'sensor.precipitation_probability'
2:13:28 PM – (ERROR) Template
Error while processing template: Template("{{ state_attr('weather.42_pine', 'forecast') [1]['precipitation_probability'] }}")
2:13:28 PM – (ERROR) helpers/template.py
Please share the state and state attributes of waether.42_pine entity.
Apologies it’s the Accuweather integration just with 42 Pine as the friendly name, below are the state attributes;
Thanks for your assistance.
temperature: 10
humidity: 66
ozone: 0
pressure: 1026
wind_bearing: 315
wind_speed: 13
visibility: 16.1
attribution: Data provided by AccuWeather
forecast:
- datetime: '2021-08-17T21:00:00+00:00'
temperature: 18.2
templow: 8.1
precipitation: 0
precipitation_probability: 1
wind_speed: 14.8
wind_bearing: 172
condition: partlycloudy
- datetime: '2021-08-18T21:00:00+00:00'
temperature: 21.1
templow: 9.7
precipitation: 0
precipitation_probability: 2
wind_speed: 14.8
wind_bearing: 26
condition: partlycloudy
- datetime: '2021-08-19T21:00:00+00:00'
temperature: 22.6
templow: 11.4
precipitation: 0
precipitation_probability: 6
wind_speed: 14.8
wind_bearing: 344
condition: sunny
- datetime: '2021-08-20T21:00:00+00:00'
temperature: 23.6
templow: 10.3
precipitation: 0
precipitation_probability: 2
wind_speed: 14.8
wind_bearing: 268
condition: partlycloudy
- datetime: '2021-08-21T21:00:00+00:00'
temperature: 24
templow: 13.7
precipitation: 0
precipitation_probability: 2
wind_speed: 14.8
wind_bearing: 19
condition: sunny
friendly_name: 42 Pine
Please try this configuration in your value template.
{{ state_attr('weather.42_pine', 'forecast') [1].precipitation_probability }}