Template condition with forecast in automation not working

I am trying to setup an automation to close my blinds when the max temperature gets above 20.
I have this automation for test and it doesn’ matter if I test it with > or < it always sends me a notification

alias: Rolluiken
description: Rolluiken naar xx
trigger:
  - platform: time
    at: "09:00"
condition:
  - condition: template
    value_template: >-
      {{ state_attr('weather.forecast_home','forecast')[0]['temperature'] < 20
      }}
action:
  - service: notify.whatsapp
    data:
      message: It is not hot, blinds are opening

Do I need to check the condition template somewhere?

If I you the condition in the message I get a true and false so the statement seems right.

You can test your template in /Developers Tools/Templates
However your template works, if you try with <= OR >=
But i think you should want to go with … weather.forecast_home_hourly … and … <=
To get the nearest (current)temperature ( use “weather.forecast_home_hourly” )

your template is not going for “current” temperature, somehow state(weather.forecast_home) forecast “use/set” highest during the days 0-5

I use local devices for current temperature ( in templates ), as it’s always differs few degrees from weather providers and my “spot”

PS: however i also think this automation will not survive the “Breaking” point 2024.4(or 3) where the attributes “should” be removed

If you are using the “Run” button or the automation.trigger service to test the automation… those skip the trigger and conditions, the actions are simply executed.

1 Like