Automation question - one automation is blocking another

So I have this automation that is kicked off by a MQTT message

- id: Deck_Outside_Lights
  alias: 'Deck-Outside-Lights'
  trigger:
  - platform: mqtt
    topic:  cmnd/Deck-Outside-Lights/POWER
    payload: 'TOGGLE'
  action:  
    - service: switch.turn_on
      entity_id:
      - switch.deskdoorlamp_128

When I trigger it I’ll see that it starts - but the light never turns on…If I disable THIS automation it works fine:

- id: OffOutSideLights-Day
  alias:  'OffOutSideLights-Day'
  trigger:
  - platform:  state
    entity_id:  
    - switch.deskdoorlamp_128
    from: 'off'
    to:  'on'
  condition:
  - condition: numeric_state
    entity_id: sun.sun
    value_template: '{{ state.attributes.elevation }}'
    above: 0.0
    
  action:  
    - delay: '00:00:10'
    - service: switch.turn_off
      entity_id:
      - switch.deskdoorlamp_128

The second scripts looks for that light to be on during the day - and if so turn it off in 10 seconds. I never see the light turn on due to the first automation as long as the 2nd one is enabled…I’m running
Home Assistant
0.84.5

in docker on ubuntu…

Thanks for any help…

R

What happens if you change your second automation to this:

- id: OffOutSideLights-Day
  alias:  'OffOutSideLights-Day'
  trigger:
    platform: state
    entity_id: switch.deskdoorlamp_128
    to:  'on'
    for:
      seconds: 10
  condition:
    condition: numeric_state
    entity_id: sun.sun
    value_template: '{{ state.attributes.elevation }}'
    above: 0.0
  action:  
    service: switch.turn_off
    entity_id: switch.deskdoorlamp_128

Tom, that worked! If you don’t mind can you give a short explanation on why? I think I could guess but would like to have someone more knowledgeable than me explain. Really appreciate that quick response…

…REK

I think you screwed the pooch with your indenting for the actions… The delay and the service should be shifted 2 spaces left (as well as the remaining lines for the service.

Also automations do funny things if you call them a second time and the delay is still running in the first one.

I screwed up the indentation too. If it works for you good, but it should probably be updated to my edited version above (note the action: indentations).

the switch can go on the same line as the entity id too… and the -'s seem optional when only 1 item. YAML is a harsh mistress (cept when it’s not)

Thanks. Fixed.