How to switch tradfri bulbs with dumb light switches? Sonoff/Shelly switch with Tasmota the solution?

I have a bunch of Tradfri Smart Bulbs deployed in our apartment and hooked up to home assistant.
The bulbs come with a wireless remote, which allows for switching but also dimming and changing the color of the bulbs.

This setup is not only ugly but can also become confusing for guests.
I’d like to replace the current setup with a solution that can be switched with an in-wall switch.

I have the following requirements:

  • Switching off the wall switch should kill the mains power to the socket (safety first).
  • Dimming and color changes of the bulbs should still be possible as with the original tradfri remote.

The question is how can I do this safely?

I’ve been looking at the shelly switches, which seem to be a nice solution since they are flashable with the tasmota firmware.

Now, I’m wondering if tasmota can be configured so that it can recognise certain button press patterns. E.g. long press should be recognised in the firmware and directly kill the mains power to the bulb, while every other pattern should be simply relayed to home assistant for further processing.

Would this work? What are people here doing? What’s a safe/elegant/robust and cost efficient way of achieving the above?

1 Like

I have Tradfri bulbs working with Xiaomi switches . Be aware what ever solution you put in place, when you cut power to the tradfri bulbs , they can take up to 50 seconds to be rediscovered by HA. If you issue any commands before they sync, the bulbs can become very confused. see the following

I have a number of appdeamon scripts and sensors , which keep the tradfri bulbs synced and stops commands being sent until the bulbs are available

Do you have more than 1 bulb on each light switch ? (I have 6 on 1 switch). If you group the bulbs into light groups , you must ensure all bulbs are available or you will find some bulbs will not behave correctly and flicker or turn off.

It does work, but it needs careful setup, but much better than being permanently on , and switched with the wireless controller

What are the dangers of leaving the circuit ON and turn on/off wirelessly?

You will have a live circuit permanently running even when the lights are “off” could be dangerous, i’m sure an electrician would be impressed :slight_smile:

The lights will not work if HA or wireless switch fail. Not good . Home automation should not interfere with fundamental operations see

1 Like

I’m a total noob at these topics but my IGNORANT rationale was that there’s a lot of things in your home that are always on like a freezer or a TV (even if the TV is turned off the circuit is ON) so why having a light circuit always ON is a danger but not the TV or the freezer?

What would happen if the bulb failed and went pop. Someone other than you turns the wireless switch off and thinks the the electricity is off . Then takes out the bulb out. 240 volts can kill !

IMHO that could easily happen on a regular installation as well :thinking:

How ? At the very least a physical switch will turn off the electricity supply to the bulb If you wire a lighting circuit to bypass .a physical switch and leave the circuit permanently on your asking for trouble. Please speak to an electrician

I imagine you mean:
If a bulb fails you have no way of telling if the power is on/off (all of my bedroom lights are controllable from the landing as well as the rooms themselves so I can’t just look at the switch position) so I may end up trying to put a new bulb into a live fixture as my house is currently wired up anyway.

I asked my electrician about over-riding the switches and having them permanent live, and my reasons and he said wrapping yellow electrical tape around the edge of each fitting and using a sharpie to write “Perm Live!” on will be enough to just remind you to kill the lighting circuit at the junction box if you do replace a bulb.
HOWEVER! He also said “if you kill yourself though, it’s on you…”. :smiley: I ended up not doing that…surprise surprise…

You can easily have the problem of “electrocuting yourself” by “not correctly cutting electricity off” in the circuit box/switch on a regular installation. But I know what you mean, in my case that won’t be a problem.

Exactly, I don’t want to be a member of the Darwin Awards :slight_smile:


Haha not want that either. In my case I always go to the circuit breaker when I need to do stuff.

@lonebaggi thank you for your very valuable insights. It is unfortunate, that it can take this long until the tradfri bulbs are rediscovered by HA.
It would be neat if there were bulbs that could be controlled via the power line, instead of some radio signal.
I’m thinking about going back to dumb bulbs in the long run, and use smart switches instead. The only thing that is holding me back atm is that I haven’t found any bulbs where one can change the color via some impulse sent over the wire.

Maybe someone in here does have experience with Tasmota and/or shelly switches and can share some insights as to what I want to do is feasible with those?

What you can do with Shelly or Tasmota is to have the switch detached, so you are turning on/off the smart light directly instead of cutting off electricity. Is the best thing I found out so far.

1 Like

I’ve added long transitions (3 seconds) between any colour/brightness changes for automations so that the whole thing is less jaring.
previously when flicking on the light switch after sunset my lights would come on full brightness and then a couple of seconds later snap over to orange and low brightness, it used to make your eyes go funny.
Now we turn the light on, it comes on full brightness for a few seconds and then gradually fades to the new setting. It seems a lot better, but it’s still a shame they dont come on the correct colour/brightness straight away.

The only reason I use a Tradfri /Xiaomi combination, is the Xiaomi switches do not support dimming. The solution does work very well . You just have to “program out” the sync issues to stop multiple commands from being issued , before the bulbs are ready.

If the dimming or colour commands are issued via Alexa and the bulbs are still syncing I issue a TTS to Alexa to warn the user the bulbs are not ready . I then store up the commands until the bulbs are ready.

In reality the 50 second sync hardly ever gets in the way. As long as the bulbs behave uniformly it’s all OK . It when bulbs are set at different brightness or some are off , you notice.

I think the 50 second sync is a particular issue with the tradfri hub ?

Smart switches with smart bulbs give you the best of both worlds as long as you can figure out how the smart bulbs react when power is switched off.

@lonebaggie I’m just curious after reading this thread: Are all the ZWave dimmers/switches and bulbs also considered always on, and hence a permanently running live circuit? Because that’s 100% of the non-battery powered home-automation devices.

I’ve always been a bit concerned about having those little devices hidden behind my switches or my electric boxes at home. Some of them do have fuses for protection but in any case, they are 100% of the time on.


Since Zigbee devices can form a better mesh network than any other device, I would suggest another way, IF you have some soldering skills:
Keep the Tradfri bulbs where they are. Buy a Sonoff T3 or T0(or similar) touch wall switch (2 button as I can see) with wifi. Flash the wall switch with Tasmota. Change the configuration of the touch buttons with ButtonTopic so they don’t actively change the relay, but send an MQTT topic instead to Home Assistant. Grab the MQTT message and do what you want (meaning throwing direct command to the Tradfri Bulb to turn on or off)
This way, people can still use the switch to turn the bulb on or off (but not cut the power, just give the zigbee command) AND if a bulb is burnt you can turn the sonoff relay off from home assistant to cut the power to the bulb and replace it. Safe and sound.
Any other way would kill the brighntess option. If you don’t care, you can just replace the Tradfri bulb with a regular led and install a Sonoff wall switch.
Wall switches for 2 relays (2 gang are called) are about 15usd.

Thanks @pvakerlis.
Just saw your response.
This is what I was looking for and what I finally did.

1 Like

How would this cut the power to the bulb? What am I missing?