Automation and conditions for actions

Is it possible to have one automation have a condition that is specific just to one action out of multiple actions?

For example if I had an automation called welcome home, that had a single trigger based on occupancy but two actions… One action I always want to fire such as a welcome notification, and a second action of turning on a light, but only if it is after sunset?

have the automation turn on a scene or turn on a script depending if the items require a sequence or not.

You could have the action call a script. Then, in a script, you can place conditions within the sequence. The first time you hit a condition that tests false, the script halts. So, some pseudocode:

action:
  welcome notification
  condition: is the sun below the horizon?
  turn on a light

So the light would only turn on if the sun is below the horizon.

(aside: Can you put conditions in the action block of an automation? I don’t think I’ve tried that - my code only has conditions that halt the entire automation…)

I had figured calling a script would be one of the options, however seems to be a bit of extra work for what I want to achieve.

Conditions can go in the action block as far as I can tell but they impact all actions unless I miss understand the syntax.

They only affect the actions after the condition so you can put some actions above it and they remain unaffected :slight_smile: