If-then(-else) actions are finally coming to Home Assistant

Updated on
Home Assistant Core 2022.5
Disclosure: This post contains affiliate links. If you click through and make a purchase, I’ll earn a commission, at no additional cost to you. Read my full disclosure here.

I can’t claim to be an expert in programming, but when I started experimenting with BASIC and later C, it was all about the if-then-else conditionals. Throughout the last twenty years, this very basic conditional has stuck with me and after porting the majority of my automations from Node-RED to the Home Assistant Dashboard, it was something I sorely missed. While the Choose action does allow me to create anything from basic to advanced if-then-else structures, I always longed for a simpler and cleaner way of doing this.

A screenshot of a Home Assistant automation showing the new if-then-else function. This function is being used to turn on a light if a motion sensor detects any motion.
This is what the new if-then(-else) action looks like

As it turns out, I wasn’t the only one yearning for such a function. With the release of Home Assistant Core 2022.5 our calls have been heard, as Home Assistant now finally supports an if-then(-else) action. This type of action won’t allow you to do anything you couldn’t do before, but it will make the creation of automations easier and faster.

Liam Alexander Colman, the author and maintainer of Home Assistant Guides.

About Liam Alexander Colman

Liam Alexander Colman has been using Home Assistant for various projects for quite some time. What started off with a Raspberry Pi quickly became three Raspberry Pis and eventually a full-blown server. I now use Unraid as my operating system, and Home Assistant happily runs in a Docker container. My personal setup includes many Zigbee devices as well as integrations with existing products such as my Android TV box. Read on to find out more on how I got started with Home Assistant.

Leave a comment

Share to...