Good morning to all!
I’ve finally decided to get rid of old legacy template definitions and I’m moving to the new format. In the process, I’ve decided to add all the missing availability leafs, to tighten my setup.
Digging into the docs, it seems it’s fully supported. But for some reason the following code trigs the above error.
# This block is inside a yaml file which is referenced in configuration.yaml using:
# template: !include_dir_merge_list includes/templates
- sensor:
- unique_id: weather_home_today_precipitation
name: Weather at Home - Today precipitation
state: >
{{ state_attr('sensor.daily_weather_forecast_at_home', 'forecast')[0].precipitation | float }}
availiability: >
{{ state_attr('sensor.daily_weather_forecast_at_home', 'forecast') | length > 0 and
state_attr('sensor.daily_weather_forecast_at_home', 'forecast')[0].precipitation | float(none) is not none }}
unit_of_measurement: "mm"
attributes:
template: weather
At first i though I was mixing some legacy code by mistake, but now I’m quite sure I didn’t.
What’s wrong with that template definition in your opinion?