brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: mode: queued and max keep a Home Assistant automation from dropping triggers

Home Assistant
~/tips/tip-home-assistant-automation-mode-queued-max

mode: queued

Chooses what a Home Assistant automation does when it triggers again while still running.

An automation that triggers again while it is still running can lose that second run, and all you get is a warning in the log. The mode option decides what happens, and the default may not be what you want.

The docs list four modes. single is the default and does not start a new run while the automation is running, and it logs a warning. restart stops the current run, including a delay or a wait, and starts again. queued starts the new run after all earlier runs have finished. parallel starts a new, independent run right away.

mode: queued
max: 25

With queued and parallel you can set max, the number of runs allowed at the same time. The default is 10 and the minimum is 2. For single mode the limit is effectively one.

If the warning in the log annoys you more than the lost trigger, there is max_exceeded. The docs show a throttled automation like this:

mode: single
max_exceeded: silent

Setting it to silent stops the “Already running” message from being logged. The default level is warning.

Caveat: queued is not free. If every run contains a long delay, the queue just gets longer, and the last one runs much later than the event that started it. For a motion light I would pick restart instead, so the timer starts over with each new movement.

Further reading: Automation modes (Home Assistant documentation)

Going deeper: Guide: Home Assistant backups in Docker, with a failure alert on your phone and a copy off the box

More Home Assistant tips Trust X-Forwarded-For: on Unlimited login attempts: off automation: sequence: template: All Home Assistant tips (11) All topics

Link