I’m working on an automation going off of the code found here: Automation to retrieve and Publish hourly weather - #8 by 123
Is it possible to keep the object while still transforming the datetime?
I was trying to do this but failing:
rainy_times: >
{{ my_hourly_forecast['weather.forecast_home'].forecast
| selectattr('condition', 'in', ['rainy', 'windy', 'pouring', 'cloudy', 'partly cloudy'])
| selectattr('datetime', 'as_datetime')
| selectattr('datetime', 'as_local')
| selectattr('datetime', 'ge', today_at('06:00'))
| selectattr('datetime', 'le', today_at('20:00'))
| list }}
It gives me this error:
Error: TemplateRuntimeError: No test named ‘as_datetime’.
How can I go about getting a list of the original objects that meet the criteria of condition and time range?
Thanks!