Adding Automation

Teach Home Assistant What To Do When Something Changes In Your Environment

Home Assistant provides you access to all of your wireless devices, whether they are commercial or ESPHome DIY. With dashboards covered in a previous article, you control devices manually. With Automations, you teach Home Assistant how it should respond automatically whenever a device entity changes.

Visiting Automations

To view and add new automations, click Settings in the Home Assistant sidebar, then click Automations & scenes. This opens a view with a list of all of your automations. At the beginning, this list is of course empty.

Creating New Automation

To create a new automation, click CREATE AUTOMATION in the lower right corner. This opens a dialog that walks you through creating the new automation task.

I’ll walk you through creating a simple new automation that assumes that you have created a simple push button device, and you’ll see how easy it is to connect this push button to a remotely controllable electrical plug: in the future, whenever you press the push button, the electric plug toggles state.

  1. Click Create new automation to create a new blank automation. You can now graphically define when this automation script should be triggered, if there should be additional conditions met, and then what needs to be done:

  2. Click ADD TRIGGER, then click Device because you want something to happen when one of your devices changes.

  3. Enter part of the device name. If you created the ESPHome push button device, enter push. The device shows in the combo box. Select it.

  4. In the textbox Trigger, you see the various state changes that you can select. Push Button Pushbutton1 turned on is already selected. That’s perfect: you want something to happen when the pushbutton gets pressed (aka when it is turned on).

  5. Move to the section Then do, and click ADD ACTION to determine what should happen when the push button is pressed.

  6. Click Device because you again want to access one of your devices. In this example, I want to access one of my smart Tuya electric plugs that I added to Home Assistant earlier. You can of course target any available device.

  7. Select the device, i.e. by entering part of its name.

  8. In the textbox Action, you now see the actions this device supports. For my electric plug, I choose the action Toggle Plug. Click SAVE to save your automation.

  9. Enter a name for your new automation, and optionally describe what it is used for. Once you add many more automations, this helps you keep organized. Then click SAVE.

Now you are done. Click the left arrow on top to return to the list of automations. Your new automation is already functional.

When you now press the push button, Home Assistant automatically senses the state change and executes your automation. The electric plug toggles, and you now have a way to control electrical devices from your push button device.

Comments

Please do leave comments below. I am using utteran.ce, an open-source and ad-free light-weight commenting system.

Here is how your comments are stored

Whenever you leave a comment, a new github issue is created on your behalf.

  • All comments become trackable issues in the Github Issues section, and I (and you) can follow up on them.

  • There is no third-party provider, no disrupting ads, and everything remains transparent inside github.

Github Users Yes, Spammers No

To keep spammers out and comments attributable, all you do is log in using your (free) github account and grant utteranc.es the permission to submit issues on your behalf.

If you don’t have a github account yet, go get yourself one - it’s free and simple.

If for any reason you do not feel comfortable with letting the commenting system submit issues for you, then visit Github Issues directly, i.e. by clicking the red button Submit Issue at the bottom of each page, and submit your issue manually. You control everything.

Discussions

For chit-chat and quick questions, feel free to visit and participate in Discussions. They work much like classic forums or bulletin boards. Just keep in mind: your valued input isn’t equally well trackable there.

  Show on Github    Submit Issue

(content created Jul 08, 2024 - last updated Jul 12, 2024)