Question about auomation modes

I read about the different modes of automation as explained here. However, it was not clear to me what the behavior is when multiple (different) automations are triggered. What is the order of execution?
Is there a way to control automations so a triggered automation cancels the execution of a different one (if that one was triggered)?

To explain more: I have two automations:

  • The first one is triggered that when switchA is ON, and under some conditions, the result is I turn switchB ON.
  • The second one is triggered when switchA if OFF. In this case, I turn off switchB and switchC.

The problem is when the second automation is triggered while the first is being executed. In this case, I want to cancel the execution of the first.

The automation mode is per automation (per id). Have two different ‘single’ automations triggered at the same time and they will run in parallel.

Thanks. That’s what I am doing right now. But it is creating all sorts of problems with different automations being triggered while others are running. Is there a way to stop the executions of other automations with one is triggered?

That happens if your automations are to complex, to long-running, trying to pack everything into a single automation. Try to keep them atomic, simple, short-running.

E.g. instead of using delay in the action sequence, create another automation that observes the state of an entity for: a given time.

Otherwise: Automations are entities in the automation domain and you can enable and disable them. I don’t know if that actually stops an already running automation.

Maybe you provide an example of a problematic automation?

You are talking about a very advanced use case. Not many people have an issue like yours.
The only (that I know of at least) way to deal with this is to have all your separate automations. (that are interrelated) call a single script (ALL of these will need to be mode single, apart from the script which would be restart, to ensure it ran with just the latest ‘conditions’ )
The script would have to set all output’s concerned given the inputs that triggered the script (use ‘choose’ if complex)

Edit: I think turning off an automation ‘mid-run’ will have unpredictable results

@Mutt, that sounds very reasonable. Thank you!