ErikdeVries.com
ErikdeVries.com

Cheap and easy way to convert dumb wall mounted light switches into smart switches

Published on Last updated on

The premise is simple, I want to use my existing "dumb" wall mounted light switches to control my smart lights without spending too much money.

Philips Hue also saw the need to solve this, so they introduced the Philips Hue wall switch module. This is exactly what I need, it does however come at a steep price of around 35 euros per module (almost as expensive as purchasing completely new smart wall switches).

While browsing the Home Assistant forum I came across a cheaper (and more fun) solution, by connecting the Aqara door sensor to a wall mounted switch. You can find these sensors on AliExpress for around 10 euro's a piece, or on Amazon for around 18 euro's. And the good thing is I have been using these sensors for quite some time on my doors, so I know they are reliable and the batteries last for a very long time!

In this blog I want to share how I modified the Aqara door sensor and how I set-up Home Assistant to control my lights.

Before you start

I highly recommend connecting the sensor to Home Assistant before you start. This way you know for sure the sensor is working before you start. I connected the sensor using Zigbee2MQTT.

First enable pairing of new devices in Zigbee2MQTT. Next remove the battery slip and press the button for around 5 seconds on the door sensor. This should result in the device showing up in Zigbee2MQTT.

Modify the Aqara door sensor

We need to do a small modification to the door sensor so we can connect it to the wall mounted light switch. We need to open the sensor and remove the battery before we continue. My advice is to use a screw driver to get everything out of the case.

Out of the box the door sensor uses a magnet to switch between "open" and "closed". If the magnet is close to the sensor it pulls two (very small) metal parts together making a connection and showing the door as closed. When the magnet moves away the two metal parts move away from eachother and the connection is severed, showing the door as open.

Aqara Door Sensor opened

On the image above you can see a blue(ish) glass cylinder that we will remove (in theory you could keep it in place, but keep in mind that magnets will interfere!). I decided to cut it off instead of desoldering it (in my first try I messed up, resulting in a broken sensor).

Next we need to solder two thin wires to the board. My advice is to be careful as the board is quite delicate. Make sure the wires are thick enough so you can connect them with the wall light switch.

Aqara Door Sensor with soldered wires

The final step is to put it back in the case. As it now has two wires connected to it, you need to cut away part of the case (or drill small holes). To be extra sure everything stays in place I used some hot glue to glue the wires to the board. Make sure you can still open the case and replace the battery when it is empty!

Aqare Door Sensor connected

And we are done with the modification. You can test if everything is working by connecting the two wires together. This should result in the contact value updating in Zigbee2MQTT.

Place the sensor behind the light switch

The final steps are quite easy, but you have to turn off the power first!

We will now remove the wall mounted light switch, disconnect the wires and connect the two wires together using a clamp (lasklem in Dutch). This results in the light being always on (this is exactly what we want, as they are smart lights which we will turn on and off using a smart home solution, not by cutting the power).

Finally connect the two wires coming out of the door sensor to the wall light switch. Check if pressing the wall switch updates the status of the sensor in Home Assistant!

When everything is working we can place the wall switch back into the wall and we can turn the power back on.

Set-up Home Assistant

Now we create a basic automation in Home Assistant that does the following:

When:
- entity for door sensor changes from open to closed (or)
- entity for door sensor changes from closed to open

Do:
- toggle scene "lights in dining room"

This automation will execute only when the door sensor changes from "closed to open" or "open to closed" (meaning, when someone actually presses the wall switch button, and not when it e.g. becomes unavailable). When this happens it will toggle the scene I have set-up for the lights in the dining room (so if the lights were on, this will turn them off).

And we are done! The power to the smart lights will now always stay on so we can automate them any way we want! But when someone enters the room and wants to turn them on or off using the wall switch they can!

Downsides?

For me this solution is exactly what I need. But I see two potential downsides in this solution:

  • When Home Assistant is down there is no easy way to turn lights on or off (as you cannot easily cut the power to the lights).
  • This solution only has a "on" / "off" option, so if you want to easily dim lights you might need a different solution (although you can create an automation that for example changes the brightness when the light is turned off and on again quickly).