Wait template

maybe i don’t know for sure as well

Either create four separate automations, or use separate triggers for each time and conditional actions such that the execution is always “instant”. It’s not a good idea to have automations running for a long time, as there are various ways that they could get interrupted (restarts, reloads etc).

As an example, this should work. It’s basically the same as yours but doesn’t wait within the automation. It does one thing and finishes each time.

alias: Exterior - Evening Lights Automation
description: ""
trigger:
  - platform: sun
    event: sunset
    id: "sunset"
  - platform: time
    at: "23:00:00"
    id: "night"
  - platform: time
    at: "23:59:59"
    id: "midnight"
  - platform: sun
    event: sunrise
    offset: "-02:00:00"
    id: "dawn"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: "sunset"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 75
            target:
              entity_id:
                - light.front_facade
                - light.outside_entrance
                - light.outside_columns
      - conditions:
          - condition: trigger
            id: "night"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 15
            target:
              entity_id:
                - light.front_facade
                - light.outside_columns
                - light.outside_entrance
      - conditions:
          - condition: trigger
            id: "midnight"
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id:
                - light.front_facade
                - light.outside_columns
      - conditions:
          - condition: trigger
            id: "dawn"
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.outside_entrance
mode: single
1 Like

Ohh yes. I have similar way of automation. Work great indeed… thanks to pop this up.

1 Like

@Troon

Thanks! Will try that! Looks very logical!

Hi there,

Can you help me out with this? I have affinity with software but far from a pro :wink:
Where I have to put the “wait template”? De tts isn’t audible probably because the automation proceeds before tts can do it’s task.

alias: "raamsensor luna gesloten: Tado en AC aan"
description: ""
trigger:
  - type: not_opened
    platform: device
    device_id: e74e39efd80eba2ab1bd7f0db2771bfd
    entity_id: binary_sensor.contact_sensor_4
    domain: binary_sensor
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.luna
    data:
      media_content_id: >-
        media-source://tts/cloud?message=Je+raam+is+dicht+dus+je+verwarming+of+airconditioning+kunnen+eventueel+aan.&language=nl-NL&gender=female
      media_content_type: provider
    metadata:
      title: >-
        Je raam is dicht dus je verwarming of airconditioning kunnen eventueel
        aan.
      thumbnail: https://brands.home-assistant.io/_/cloud/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: provider
          media_content_id: >-
            media-source://tts/cloud?message=Je+raam+is+dicht+dus+je+verwarming+of+airconditioning+kunnen+eventueel+aan.&language=nl-NL&gender=female
mode: single

ohh with this complex metadata im not into. I really dont know…

thanks anyway poudenes. Anyone else there to help me out?

@Troon Thanks! Works like a charm! And also very logical!

1 Like