Skip to main content

Automation Modes

One of the key aspects of setting up automation is defining its behavior, i.e., determining what should happen when the automation is triggered while the previous run of this automation is still in progress.

The automation behavior mode can be set either during creation or later changed during editing via the three-dot menu in the top right corner by selecting Change mode.

Script modes

Script modes

There are four types of behavior, with the default being single. We won't describe the theory here, but we'll show the modes with a specific example, which I think will help you understand better.

Script modes

Example with Garage Doors

Let's take a device - garage doors, where the execution of a certain action is not immediate but takes some time.

Script modes

We try to call the toggle action, i.e., closing the doors if they are open and vice versa.

Thanks to the behavior settings, we can influence what happens if we activate the 'toggle' function and the doors start opening, but we activate this function again during their opening.

We can set it so that the doors immediately start closing - restart mode, so that the second call of the function is ignored - single mode (a warning is logged), or so that it waits until the doors are fully open and then immediately starts closing - queued mode.

Example of a warning in the log in single mode
2023-12-28 17:38:15.327 WARNING (MainThread) [homeassistant.components.automation.single_automation]
Single automation: Already running

There is also a parallel mode, which causes two actions to run simultaneously, but this doesn't make sense in the case of doors.

Comments