4 Home Assistant Actions for Powerful Automations
- Home Assistant has come a long way since the days when all your automations had to be written in YAML.
- A lot of my automations contain some similar actions.
- I could have added notification actions for all three devices to each automation that required them.
Home Assistant has come a long way since the days when all your automations had to be written in YAML. These days, you can build automations in the automation editor without seeing a single line of code. With so many actions to choose from in the automation editor, it’s easy to miss some of the most useful ones.
Call a script
A lot of my automations contain some similar actions. For example,I have multiple automations that send a notification to my phone, my wife’s phone, and if we’re home and it’s powered on, to my smart TV.
I could have added notification actions for all three devices to each automation that required them. Rather, I wrote a script that requires the message as input and then sends that message to all three devices.
The benefit of calling a script rather than adding three notify actions to each automation is that if I ever decide to change which devices I want my notifications to go to, or we upgrade our phones or our TV, I’ll only have to make changes to the script. All the automations that call that script will work as was to be expected once the script is updated,saving me from having to wade through multiple automations to fix them.
“`html
4 Home Assistant Blueprints That Saved Me Hours of Effort
That’s where the “choose” action comes into play. Instead of just having two options (“if” and “else”),you can add multiple sets of conditions. The first option where all the conditions are met is the one that will run. You can also add a set of default actions that will run if none of the conditions are met.
Using the “choose” action has a number of benefits, such as helping you trim down a a template is evaluated as true. If it isn’t, the automation will stay paused.
The template is evaluated again whenever an entity that the template references changes state.If the template still isn’t true, the automation will continue to wait. Only when the template is re-evaluated as being true will the rest of the actions be performed.
The “wait for a trigger” action can be used to pause the automation until a specific trigger event happens. These are the same triggers that you use to make Home Assistant automations fire, such as a button being pressed or motion being detected.
For all “wait” actions, you can add an optional timeout that will stop the automation after a set period of time elapses. This ensures that a “wait for a template” action does
Okay, I understand. I will adhere strictly to these guidelines. Please provide the UNTRUSTED source text. I will then process it through the phases you’ve outlined to produce a clean, factual, and authoritative HTML output. I am ready when you are.
