Conditional actions in automations; am I missing something?

I’ve currently got almost all of my automations in NodeRed, which mostly works great but trying to figure out what went wrong with an automation can be a real pain.

The new automation tracing in HA looked like the perfect solution … but automations still feel way too limiting (unless, as per the title, I’m missing something obvious). Is there any way to run actions conditionally without resorting to templates and thus losing the tracing?

For example a simple:

automation:
  trigger:
    - platform: sun
      event: sunset
  action:
    - if some_condition
      - service: light.turn_on
        target:
          entity_id: light.living_room
     else
      - service: light.turn_off
        target:
          entity_id: light.living_room

https://www.home-assistant.io/docs/scripts/#choose-a-group-of-actions

That looks like exactly what I need, cheers!

I did read through the automation documentation and couldn’t see any reference to this, did I miss it or is that a bit of the documentation that could be improved? (happy to file the PR myself if so)

The advanced action flow control methods are all listed on that page. Don’t be put off by the word “script” in the title. Automations are just scripts with triggers.