Wait for trigger timing out even when condition is met

Hi all,

I recently moved from Fibaro to Home Assistent and so far loving the possibilities. I have most automations and scripts setup but one still is not working as I would expect it to do.

I have a script that finalizes the morning automation. In winter time the script should wait until the light passes a specific value stored in a variable. In summer the light level is alsways past that value and should continue right away. I use the following code to achieve that but the “waiy for trigger” time-out even when the light level is way above the set level. What is whrong or what am I missing:

alias: Routine - Sluit ochtend af
sequence:
  - wait_for_trigger:
      - platform: template
        value_template: >-
          {{ states('sensor.buitensensor_achter_illuminance') | float >
          states('input_number.lichtdrempel') | float }}
    timeout: '3600'
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.alle_lichten_uit

Thanks.

For how you want it to work, I suggest you use a wait_template.

alias: Routine - Sluit ochtend af
sequence:
  - wait_template: "{{ states('sensor.buitensensor_achter_illuminance') | float(0) > states('input_number.lichtdrempel') | float(0) }}"
    timeout: '3600'
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.alle_lichten_uit

It waits until the template evaluates to true or 3600 seconds elapses, whichever comes first.

Hi Taras,

Thanks, that did the trick.

1 Like