Smart bulbs are great. Change colors, change brightness, turn on/off from phone. But then it happens. Someone turns the switch off and the smart bulb is unavailable. Dang.

I fundamentally believe that automation/smart-home stuff shouldn’t impact usability — if there’s a switch, it should work as it is intended to. This write-up will detail how to put a smart-bulb in a lamp and have it be fully available for automations, voice-assistants, and phone/computer control…..while still providing a standard rotary switch at the lamp that works as intended and does not prevent home automation software from interacting with the light as well. The switch can turn the bulb on/off at any time, and home automation software (home-assistant, for example) can fully control the bulb as well.

THIS ARTICLE ASSUMES YOU HAVE ALREADY FLASHED YOUR SMARTBULB TO TASMOTA FIRMWARE VIA SOLDERING OR USE OF THE TUYA-CONVERT UTILITY. IF YOU HAVE NOT CONVERTED TO TASMOTA YET, PLEASE DO SO, SEE THIS VIDEO PLEASE .

We start with a Lohas RGB smartbulb that has already been flashed to Tasmota (via tuya-convert). There are (2) versions of these bulbs. For this project, you need the older versions that still have the solder pads under the diffuser. This is important… Generally, any smart bulb with exposed TX/RX or other available GPIO pins could be modified this same way.

First — take off the diffuser. Grab/hold/twist and it should come off. It’s glued on but should come loose without too much effort. Once it’s off, you should be able to see the solder pads for Ground/TX/RX.

We’re going to solder a basic cheap rotary switch to the RX pad, and to the ground pad. Several GPIO’s on the esp8266 are tied to firmware loading or other functions when held low (off) or high (on) at boot or power-on time. We use RX because it’s tied to an esp8266 GPIO that can be held low (off) or high (on) when the chip is powered on without causing issues. A good table for GPIO mapping can be found here, for reference.

Prepare (2) short lengths of small wire to solder to the RX and GND pads. Tin the ends of the wire with solder and use a bit of flux to help the wire attach to the pads quickly and securely.

Use the soldering iron or a knife to create a notch/gap for the wires to feed through such that the diffuser dies not pinch or bend the wires – we don’t want to have the diffuser put pressure on the wires or pull them from the pads when we reassemble the bulb. A notch in the edge of the base as well as a notch in the diffuser, when lined up, will create a proper gap. I routed the wires through the center area to keep from having them over top of any of the LED’s in the bulb.

Route the wires through the notch….

Line up the notch in the diffuser with the notch in the base of the bulb….

Reattach the diffuser with some glue.

At this point, we are ready to attach our rotary switch. The switches I used are HERE. It doesn’t matter which wire connects to which leg of the switch — All the switch does is connect/disconnect a data pin to ground. There is no voltage going through the switch and no risk of shock. Connect the two wires from the bulb to the two wires on the rotary switch.

The wires can be soldered or tightly twisted. Heat-shrink tubing or electrical tape should be used to properly cover and protect the wires from shorting.

At this point, install the bulb in your lamp and make sure the lamp is on. The bulb will power on and you need to connect to the tasmota web interface. Navigate to the “Configuration” section, and then to the “Configure Template” section.

Find the section labeled GPIO3 and change it to Switch1. GPIO3 corresponds to the RX pad, as per the ESP8266 documentation



Click “Save” — a test of the rotary switch should show your smartbulb turning on and off but staying available via web interface, and staying available to your home automation software suite.

(The default switchmode in tasmota is “toggle” which is exactly what we need. There is no need to change or configure this behavior, once the GPIO3 behavior is set to “Switch” everything is done. Tasmota switchmode documentation is HERE.)

I’m sure to come up with a better way to mount the rotary switch, but for now I’m using a ziptie and attaching the new rotary switch to the lamp using the stock switch as a base:

At this point you can go nuts with automations and scene controls to have your lamps behave however you want, all while still having a functional hardware switch on the lamp for people to use as they normally would.

In the future, I will likely look into a way to 3dprint some sort of mount that can be used to attach the rotary switch to the lamp and unscrew the stock switch stub to make things a bit cleaner.

This type of modification could also be done with a sonoff mini and a rotary switch, with a NON-smart bulb, but the procedure would be different and would involve adding a relay module into the base of the lamp under the felt cover. Maybe this will be covered in another writeup.

Good luck. Let us know if you find more bulbs that are compatible or if you have questions!

-mv

twitter.com/hackspaceio

reddit.com/u/mattvirus

matt at hackspace.io