Morning lights automation not firing

I am trying to use this automation to get my side lights to turn on in the morning at 6:15, and again at sunset. However it doesn’t seem to fire - IFTTT shows no activity so I have to assume that’s because this automaton isn’t firing and asking it to do anything.
What did I do wrong?

EDIT: I wrapped my code in the code tags but it seems to have mucked up the indentation. sigh

I forgot to mention that I can successfully trigger the automation manually.

automation side_on:
  - alias: turn on sonoff
    trigger: 
      - platform: time
        at: '06:15:00'
    condition:
    - condition: time
      weekday:
        - mon
        - tue
        - wed
        - thu
        - fri
    action:
      service: ifttt.trigger
      data: {"event":"side_lights"}
    trigger:
      - platform: sun
        event: sunset
    action:
      service: ifttt.trigger
      data: {"event":"side_lights"}

Could you try and format your code again using the </> button in the editor please? It makes it easier to see whether there are obvious syntax/indentation issues
image

Done. I somehow did it wrong the first time…

OK.
You seem to have a few errors there…

  1. you have automation side_on at the top. This is not right. automation: informs HA that the list following is a list of automations. Remove the side_on bit. Only write automation: once, not for each automation
  2. You have trigger listed twice. You can have multiple triggers but you can only “call” trigger once.
  3. You have action listed twice. As above you can only “call” action once.

Try this:

automation:
  - alias: turn on sonoff
    trigger: 
      - platform: time
        at: '06:15:00'
      - platform: sun
        event: sunset
    condition:
    - condition: time
      weekday:
        - mon
        - tue
        - wed
        - thu
        - fri
    action:
    - service: ifttt.trigger
      data: {"event":"side_lights"}

Brilliant, thanks! I’ll give that a whirl and report back…

Cool! That works perfectly, thanks!

Thanks. can you make it as solved using the check box under the solution to close this topic then?

Of course :slight_smile:

1 Like