Files
.devcontainer
.github
.vscode
plugins
sass
source
.well-known
_dashboards
_data
_docs
authentication
automation
action.markdown
basics.markdown
condition.markdown
editor.markdown
modes.markdown
services.markdown
templating.markdown
trigger.markdown
troubleshooting.markdown
using_blueprints.markdown
yaml.markdown
backend
blueprint
configuration
energy
frontend
organizing
scene
scripts
tools
z-wave
authentication.markdown
automation.markdown
backend.markdown
blueprint.markdown
configuration.markdown
energy.markdown
frontend.markdown
glossary.markdown
locked_out.md
organizing.markdown
quality_scale.markdown
scene.markdown
scripts.markdown
tools.markdown
troubleshooting_general.markdown
_faq
_includes
_integrations
_layouts
_posts
addons
android
assets
blog
blue
blueprints
changelogs
cloud
code_of_conduct
common-tasks
conference
connectzbt1
dashboards
developers
docs
faq
getting-started
green
help
home-energy-management
images
installation
integrations
ios
javascripts
more-info
privacy
security
state-of-the-open-home
static
stylesheets
tag
tos
voice-pe
voice_control
yellow
404.html
CNAME
_headers
_redirects
atom.xml
favicon.png
googlef4f3693c209fe788.html
index.html
integrations.json
robots.txt
service_worker.js
version.json
.editorconfig
.gitattributes
.gitignore
.markdownlint.json
.nvmrc
.powrc
.remarkignore
.remarkrc.js
.ruby-version
.textlintrc.json
CLA.md
CODEOWNERS
CODE_OF_CONDUCT.md
Gemfile
Gemfile.lock
LICENSE.md
README.md
Rakefile
_config.yml
config.rb
config.ru
package-lock.json
package.json
home-assistant.io/source/_docs/automation/modes.markdown

2.2 KiB

title, description
title description
Automation modes How to use and configure automation modes.

An {% term automation %} can be triggered while it is already running.

The automation's mode configuration option controls what happens when the automation is triggered while the {% term actions %} are still running from a previous {% term trigger %}.

Mode Description
single (Default) Do not start a new run. Issue a warning.
restart Start a new run after first stopping the previous run. The automation only restarts if the conditions are met.
queued Start a new run after all previous runs complete. Runs are guaranteed to execute in the order they were queued. Note that subsequent queued automations will only join the queue if any conditions it may have are met at the time it is triggered.
parallel Start a new, independent run in parallel with previous runs.

For both queued and parallel modes, configuration option max controls the maximum number of runs that can be executing and/or queued up at a time. The default is 10.

When max is exceeded (which is effectively 1 for single mode) a log message will be emitted to indicate this has happened. Configuration option max_exceeded controls the severity level of that log message. Set it to silent to ignore warnings or set it to a log level. The default is warning.

Example throttled automation

Some automations you only want to run every 5 minutes. This can be achieved using the single mode and silencing the warnings when the automation is triggered while it's running.

automation:
  - mode: single
    max_exceeded: silent
    triggers:
      - ...
    actions:
      - ...
      - delay: 300  # seconds (=5 minutes)

Example queued

Sometimes an automation is doing an action on a device that does not support multiple simultaneous actions. In such cases, a queue can be used. In that case, the automation will be executed once it's current invocation and queue are done.

automation:
  - mode: queued
    max: 25
    triggers:
      - ...
    actions:
      - ...