When automations get pesky

Reading Time: 3 minutes
IKEA Tradfri Dimmer in 3D printed holder

This is a neat little trick I recently set up in my home office. At the moment, there are 2 lights and an LED strip controlled by a motion sensor. I walk in, the lights come on. After 5 minutes of no motion, the lights go off.

That’s all fine and dandy for the most part. But I practice my guitar in there (early-ish days after a long break) and the amount of movement involved is not quite enough to keep the lights on. So, there I am, carefully trying to work out where my fingers have got to go next when the room is plunged into darkness and things get funky in not a good musical way.

Rather than stopping to wave my arms around every few minutes, I had to think of something a bit more efficient.

In Home Assistant you can have “Helpers”. One of these is the input_boolean. It’s a virtual toggle switch that you can use for automations. I set one of these up and added a condition to my Node-RED flow to check whether it was on or off. If it’s off, the automation doesn’t run. If it’s on, it does. Pretty simple. I’ve added that to my dashboard along with some others where I want to be able to control whether the automation is on or off.

Automations Dashboard

This is fine but it’s a bit of a pain as I have to either get my phone out or login to my dashboard in my laptop to turn it on and off.

At the top of this page you can see a pic of an IKEA Tradfri Dimmer switch. These are neat little switches – six quid! If you use them with the Tradfri hub then they support on/off, long press on/off and dimming. In Home Assistant you lose the dimming bit but the other 2 functions work fine. I have several of these around the house. You get a metal plate that you can screw to whatever surface you want and then the switch just attaches with a magnet. I decided to take this a step further. I designed a little holder for it in Fusion360 and 3D printed it. This screws onto a standard light switch back box. So what I’ve done in a few rooms is short the old switched live through to be permanently on and replaced the switch with my 3D printed holder. The plate that used to screw to the wall, or whatever, is in the recess and the switch just stays in with the magnet. This works brilliantly in rooms where there is a temptation for people to use the dumb switches.

Anyway, what I’ve now done with a couple of automations is set it up so that when I walk in the room to hit a few chords I switch the lights on using the switch. Switching on will turn the lights on but, more importantly, it disables the automation. Switching it off turns the lights off and enables the automation again.

So, for £6 for the switch, about 20p for the 3D printing filament and a bit of time, I have a system that gives me smart switches where there used to be dumb switches AND a way of overriding automations if I need to. Just for completeness, this is my Node-RED flow for when no motion is detected.