Platform: time Not Firing in Automation

Hi all -

I created long automation controlling all our various outside lights. I had several automations control this, but I’m trying to consolidate it onto one. It works, but then gets stuck on “Wait for time trigger” waiting for the time trigger.

I’ve scanned the forum and couldn’t figure out what I’m doing wrong.

Any help would be really appreciated.

@rossk - any initial ideas? :slight_smile:

id: '1644347134793'
alias: New Automation
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: '-00:15:00'
condition: []
action:
  - type: turn_on
    device_id: 50845f6ad43abdc59c1570516fe70bc8
    entity_id: switch.lights_front_yard
    domain: switch
  - type: turn_on
    device_id: d982d6d2e105be80261e003562f5f65f
    entity_id: switch.lights_backyard
    domain: switch
  - type: turn_on
    device_id: d9065eafc2b0138545d541c09dcd165a
    entity_id: light.lights_outside_back
    domain: light
  - type: turn_on
    device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
    entity_id: light.flood_light
    domain: light
    brightness_pct: 15
  - type: turn_on
    device_id: 8f0dc36a61c70fd54857a2c368569d64
    entity_id: light.lights_overhead_frontdoor
    domain: light
    brightness_pct: 50
  - wait_for_trigger:
      - platform: time
        at: '21:00:00'
  - type: turn_off
    device_id: d982d6d2e105be80261e003562f5f65f
    entity_id: switch.lights_backyard
    domain: switch
  - type: turn_off
    device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
    entity_id: light.flood_light
    domain: light
  - type: turn_on
    device_id: 8f0dc36a61c70fd54857a2c368569d64
    entity_id: light.lights_overhead_frontdoor
    domain: light
    brightness_pct: 15
  - type: turn_on
    device_id: d9065eafc2b0138545d541c09dcd165a
    entity_id: light.lights_outside_back
    domain: light
    brightness_pct: 25
  - wait_for_trigger:
      - platform: time
        at: '00:00:00'
  - type: turn_off
    device_id: 50845f6ad43abdc59c1570516fe70bc8
    entity_id: switch.lights_front_yard
    domain: switch
  - wait_for_trigger:
      - platform: sun
        event: sunrise
        offset: '0'
  - type: turn_off
    device_id: d9065eafc2b0138545d541c09dcd165a
    entity_id: light.lights_outside_back
    domain: light
  - type: turn_off
    device_id: 8f0dc36a61c70fd54857a2c368569d64
    entity_id: light.lights_overhead_frontdoor
    domain: light
mode: single

Not sure if this is really your intention,
but you start the automatoin with sunset - 15 mins event and wait for sunrise event.
Is that correct?

As this is normally > 8 hours of time differnet I would not recommend this.
I am not sure if there is something like a “default timeout” for automations,
but even if not there cannot be any interrupt, reload or something else during these > 8 hours of your automation running.

My recommendation would be to have the sunrise as a separated trigger within
a) separated automation or
b) separated choose condition within the same automation

As @mk-maddin states. I would avoid at all costs having such a long wait and would prefer the option to move all those wait for times to the trigger section instead and use the choose option based on the trigger.

So put sunset, 2100h, 0000h and sunrise all as triggers and give them all a trigger id of your liking.
The use 4 choose options one for each trigger id as the choose and put the appropriate actions you want under each one.

That’s how I would do it anyway :+1:t2:

somehting like this should do the job (untested):

id: '1644347134793'
alias: New Automation
description: ''
trigger:
  - id: 'sunset'
    platform: sun
    event: sunset
    offset: '-00:15:00'
  - id: 'time'
    platform: time
    at: '21:00:00'
  - id: 'midnight'
    platform: time
    at: '00:00:00'
  - id: 'sunrise'
    platform: sun
    event: sunrise
condition: []
action:
  - choose:
    - conditions:
      - condition: trigger
        id: 'sunset'
      sequence:	
	  - type: turn_on
	    device_id: 50845f6ad43abdc59c1570516fe70bc8
	    entity_id: switch.lights_front_yard
	    domain: switch
	  - type: turn_on
	    device_id: d982d6d2e105be80261e003562f5f65f
	    entity_id: switch.lights_backyard
	    domain: switch
	  - type: turn_on
	    device_id: d9065eafc2b0138545d541c09dcd165a
	    entity_id: light.lights_outside_back
	    domain: light
	  - type: turn_on
	    device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
	    entity_id: light.flood_light
	    domain: light
	    brightness_pct: 15
	  - type: turn_on
	    device_id: 8f0dc36a61c70fd54857a2c368569d64
	    entity_id: light.lights_overhead_frontdoor
	    domain: light
	    brightness_pct: 50
    - conditions:
      - condition: trigger
        id: 'time'
      sequence:
	  - type: turn_off
	    device_id: d982d6d2e105be80261e003562f5f65f
	    entity_id: switch.lights_backyard
	    domain: switch
	  - type: turn_off
	    device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
	    entity_id: light.flood_light
	    domain: light
	  - type: turn_on
	    device_id: 8f0dc36a61c70fd54857a2c368569d64
	    entity_id: light.lights_overhead_frontdoor
	    domain: light
	    brightness_pct: 15
	  - type: turn_on
	    device_id: d9065eafc2b0138545d541c09dcd165a
	    entity_id: light.lights_outside_back
	    domain: light
	    brightness_pct: 25
    - conditions:
      - condition: trigger
        id: 'midnight'
      sequence:
	  - type: turn_off
	    device_id: 50845f6ad43abdc59c1570516fe70bc8
	    entity_id: switch.lights_front_yard
	    domain: switch
    - conditions:
      - condition: trigger
        id: 'sunrise'
      sequence:
	  - type: turn_off
	    device_id: d9065eafc2b0138545d541c09dcd165a
	    entity_id: light.lights_outside_back
	    domain: light
	  - type: turn_off
	    device_id: 8f0dc36a61c70fd54857a2c368569d64
	    entity_id: light.lights_overhead_frontdoor
	    domain: light
mode: single

Something like this maybe…

trigger:
  - platform: sun
    event: sunset
    offset: '0'
    id: sunset
  - platform: time
    at: '21:00'
    id: 9 pm
  - platform: time
    at: '00:00'
    id: midnight
  - platform: sun
    event: sunrise
    offset: '0'
    id: sunrise
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: sunset
        sequence:
          - …..
      - conditions:
          - condition: trigger
            id: 9 pm
        sequence:
          - ….
      - conditions:
          - condition: trigger
            id: midnight
        sequence:
          - ……..
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - ……

You only have one choose and lots of sequences in that example :wink:

ahhh…seems the formatting broke during copy / pase ^^

Thanks for the hint :slight_smile:

You’re both awesome! I’ll try that. Many thanks, Nico

I’ll test this…

alias: Lights - Outside V2
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: '0'
    id: sunset
  - platform: time
    at: '21:00'
    id: 9 pm
  - platform: time
    at: '00:00:00'
    id: midnight
  - platform: sun
    event: sunrise
    offset: '0'
    id: sunrise
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: sunset
        sequence:
          - type: turn_on
            device_id: d982d6d2e105be80261e003562f5f65f
            entity_id: switch.lights_backyard
            domain: switch
          - type: turn_on
            device_id: 50845f6ad43abdc59c1570516fe70bc8
            entity_id: switch.lights_front_yard
            domain: switch
          - type: turn_on
            device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
            entity_id: light.flood_light
            domain: light
            brightness_pct: 15
          - service: light.turn_on
            target:
              entity_id: light.all_outside_house_lights
          - type: turn_on
            device_id: 8f0dc36a61c70fd54857a2c368569d64
            entity_id: light.lights_overhead_frontdoor
            domain: light
            brightness_pct: 65
      - conditions:
          - condition: trigger
            id: 9 pm
        sequence:
          - type: turn_off
            device_id: d982d6d2e105be80261e003562f5f65f
            entity_id: switch.lights_backyard
            domain: switch
          - type: turn_off
            device_id: 9ffa3bbb268fbdc213e3bca68a20a3c6
            entity_id: light.flood_light
            domain: light
          - type: turn_on
            device_id: 8f0dc36a61c70fd54857a2c368569d64
            entity_id: light.lights_overhead_frontdoor
            domain: light
            brightness_pct: 10
          - service: light.turn_on
            target:
              entity_id: light.all_outside_house_lights
            data:
              brightness_pct: 30
      - conditions:
          - condition: trigger
            id: midnight
        sequence:
          - type: turn_off
            device_id: 50845f6ad43abdc59c1570516fe70bc8
            entity_id: switch.lights_front_yard
            domain: switch
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - type: turn_off
            device_id: 8f0dc36a61c70fd54857a2c368569d64
            entity_id: light.lights_overhead_frontdoor
            domain: light
          - service: light.turn_off
            target:
              entity_id: light.all_outside_house_lights
    default: []
mode: single