Smart bulb with Smart Relay

So something i was trying to wrap my head around and hoping to make seamless in the house so i dont get a frustrated family.

I have a few smart bulbs, first set was the phillips hue ones for rooms where we always have fans running, so there is no need to worry about the bulbs not having power to control… in other rooms we have occupancy switches(not smart) which are just time based and not manageable. BUT this time i picked up a few VONT bulbs and looking to flash soon to incorporate into my HA setup. Right now as they sit(factory upflashed) can only control from their app and when the light is turned on… So i was wondering if the right way to proceed is to add a sonoff or shelly relay into the mix for each room/area so that i can control the power so that i can then control the light as needed.

Is this how others control wireless bulbs in your home? I would think that this is the way to achieve full control of any device that is in your smart home environment.

Bulbs OR switches. Not both. Smart bulbs are designed for always on power. Putting them behind a switch/relay not only makes the device unavailable but has a very slight chance of damaging or shortening the bulbs lifespan.

Normally I use smart switches and bulbs only in free standing lights…

If I needed to have a smart bulb so I could have color control AND wall control I’d look for a smart switch that can act as a scene controller and supports smart bulb mode (it basically switches off the power control of the switch so it always feeds power to the lamp fixtures) and then setup scenes and button controls as necessary to control the lamp.

As to what device to use to accomplish that - device availability and power requirements vary greatly by region. We’d have to know at least what country you’re in.

thanks for that, so here is a simple example of what im trying to manage… We have a small breakfast nook that has a single bulb light above the table. Currently its controlled by a standard single pole light switch and then the VONT smart bulb. Just installed it this week, so has not been flashed with anything… but that will be soon… In its current state, if i walk by and physically turn off the light then i no longer have control of that light from the app or in the future from HA.

My goal is to have control of the bulb no matter the physical state of the switch. This is why i was thinking to add the smart relays(sonoff or shelly) because that would allow me to “turn on” the power to the fixture, which would then allow me to control the bulb.

I currently have a shelly relay in one of our rooms that is rarely used… and i have control from the switch(normal switch) and from HA no matter the state of the actual switch…

So that i better understand the statement about the relay making the device unavailable, can that be elaborated on a little more? Right now i walk in, manually turn off the light i can no longer control that light until someone turns the switch back on…

In the case of having a smart relay inline, IF someone were to physically turn it off, i could potentially “turn on” the relay to allow power to the bulb, regardless of physical state, and then have control back of the bulb…

If i understand you correctly, that a smart switch would allow for both scenarios ive stated above… is that correct? So isnt a smart switch just a fancier smart relay?

Only reason i was thinking relay was because i already have a few and can do more switches around the house for less than one or two smart switches.

and im in the US /Texas 120v power

Remember that once your bulbs have the power cut, then you can’t from HA control how they react when the power get reconnected.
Some bulbs will turn on a full power, a few will turn on in off mode and others will have a user customizable preset to turn on with.
First when it is done with its turn on process and connected to the network again will HA be able to control it again.

The correct way could be a smart switch that does not control the power directly but send the command to HA which then controls the bulb.

see im still little confused or dont understand why if i tell my shelly/sonoff relay to “turn on” provide power to that light, that once its “on” why cant i control it from HA? how does HA know that the power provided is not from the switch?

Im looking at this setup at its simplest form.

Below is a breakout of how im thinking of this, which may help me ask correctly and better understand the responses.

they mean, that turning power on with switch (aka providing power to the bulb) results in some default bulb behavior. it might be turning bulb full on. ha cannot take control over it. The HA can turn it off afterwards, but you will experience a flash.

If you opt in for smart bulbs the only way is to leave them powered all the time and control them by communicating with them. Ie sending commands from HA. How to say HA to toggle the light? Using some smart switch or augmented dumb one. Ie connecting physical switch to shelly device which intercepts physical switch changes, but not breaking the circuit. You can use any shelly for this but there are dedicated devices for that for example shelly i3 which is not equiped with a relay

That’s one possibility, but im looking deeper in the system than that - you will incur errors when the power is cut by the relay, because as far as the system is concerned - that device should not be unavailable - it should always be powered. If it’s a zigbee bulb, then (as long as the bulb isnt Sengled) you actually may cause issues in the zigbee mesh because the powered device is possibly repeating for other nodes in the mesh.

Also a smart bulb is a mini computer and a radio - they don’t like being toggled on and off all the time - a standard dumb bulb - doesn’t care. But electrostatic discharge is a real thing and because smart bulbs are DESIGNED to be always on they simply dont test the effects of turning them on and off, dont be suprised if after a couple hundred cycles - they just stop responding for no good reason.

…and then FINALLY the default on behavior.

instead of a relay I’d look at a device like the Inovelli Red Dimmer (disclaimer - I know this device is as hard to catch as a unicorn right now - but with a little research ytou should be able to locate similar devices. How To: Control a Smart Bulb From a Smart Switch | SmartThings (inovelli.com) Zooz also has devices in this class as well.

What you’d do is put the device in smart bulb mode. This disables the ON/OFF/DIMMER from the wiring. But the device still sends button signals and scene commands to HA. HAA would interpret the button presses and the instructs the bulb to do something - on/off/dim/color. But the important part here is the bulb never gets cut from power. Your end users don’t know how it’s working behind the scenes and - they dont have to even care. It also satisfies one of my personal design requirements in my setup - everything needs to work without internet and without a manual. To your family - it’s just a switch.

About once every 6-8 months someone comes on with a ‘brilliant’ idea of using a relay or a smart switch to enable/disable power like this - and every time the answer is - unless you’re using a smart switch or relay DESIGNED to handle controlling a smart bulb - I wouldn’t do it. You’re asking for issues.

this is exactly what im trying to accomplish.

As for the shelly’s i have i currently have shelly 1, the semi-circle blue ones. I picked up a couple last year or year before and have a few to play around with. So isnt the way the shelly 1 wired the equivalent to what was said above about never getting cut from power? I mean right now in the one room im using that shelly 1 device, the light works with the wall switch flawlessly and controlled flawlessly from HA dashboard.

I can’t read your picture - please don’t post pictures of text, some of us are reading this on a mobile device. (the text is microscopic)

It’s simple, use whatever device you wish as a button controller - just DONT cut power to the smart bulb. That may mean wiring AROUND the device in the case of some devices to ensure line power. In the case of the Shelly - that means do NOT grab the load for the bulb off the O port - you’d instead bypass the shelly for the fixture’s hot. I have no idea if the Shelly can operate like this and I personally wouldnt set it up that way. BE ADVISED - bypassing the load like this may run afoul of some electrical codes in the non-rural parts of Texas and why I advise a smart bulb capable/ready switch like the Innovelli instead.) Also - if you don’t understand what I said - PLEASE consult an electrician.

BTW - I’m in TX as well, I hope you’re warm we’re enjoying a lot of ice watching limbs fall here.

This is how I’ve done it with my Smart bulbs and Smart Switches.

For Smart Bulb’s I use bulbs that are flashed with ESPHome - KaufHa & AtHom.

Any Smart Bulb that can be integrated into HA would do but with the ESPHome types they are completely local.

For Smart Switches I use Lanbon L8 that are programmed with openHASP. These switches replaces the so called dumb-switches I had before. In design they are pretty nice and comes pretty close to an actual physical switches that has a physical button or paddle for control. The Lanbon has a small display (2.8”) which can be configured to show sliders, buttons etc. To mimic the physical button I’ve simply designed what looks like a button. Pressing this button sends a message to Home Assistant which then can turn on my Smart Bulbs. When I say turn on I really mean set brightness to something higher than ‘0’. Setting brightness to ‘0’ is how I turn off the light so my bulbs are always powered.

Because each bulbs are always powered they are always connected to WiFi and Home Assistant so even when the lights are “off” Home Assistant can still control them.

I find the approach to Smart Light almost perfect with a few “I wish I could do this as well”

The display needs to be woken up by pressing the surface of the display. In theory you could leave the display on all the time but I’ve chosen not to.

There is no tactical feedback when you press the button but lights reacts immediately so not too much of a problem either.

The switch does require Neutral and unfortunately I have a few places where I don’t have Neutral.

Finally - While they replace a single switch - if you have 2 or 3 switches next to each other it would not fit. That said - a single Lanbon L8 switch has 3 independently controlled relays so they can control 3 different power domains.

A few other things.

The Lanbon L8 does have a light guide that can be controlled via openHASP and thus Home Assistant (it’s called Moonlight) and it can be used whatever way you fancy. Fx - if you have access to light levels in your room you could turn on the moonlight if lights are off and the room is dark making it easier for anyone to locate switches.

With openHASP you not limited to only control the lights connected to the same power as the switch. Anything that can be controlled in Home Assistant (more or less) can added to the UI on the switch. Example - I have only a single switch to control my light in my garage which is located near the entrance to my house. I have a door in my garage to get into my backyard that has a switch to control backyard light but these 2 switches are far away each other and are not at all linked. However with the Lanbon L8 switch controlling my back yard light I added functionality so I also can control the garage light from it. And while I was at it - I included the ability to open and close my 2 garage doors as well.

Because I use Smart Bulbs and because openHASP supports this I have UI such that I not only can control the light and brightness from the switch. I can even control the color from the switch so if you are in the mood for green light no need to find your phone, unlock it, find the App, open the App and then find the place in the App where you control the color of your light.

Further - in some of my rooms I have more than one bulb as “the light” and when you turn lights on and off all bulbs lights up as you would expect. It’s just - it doesn’t have to be this way. If I need only the light from one bulb I can turn that on (or the others off) from the switch - just like you would be able to from Home Assistant.

Note that in the UI that I have implemented on the switch I do have included the ability to completely remove power and I use this in the rare occasions where something crashes to simply reboot the bulbs. I just made it difficult to get to so no-one accidentally turns off light that way.

And yes everything is local.

What else - the switch supports power monitoring which is nice. They come in versions for the US (I’m in California) and they come in EU and AU version I believe.

Be sure to avoid the SmartLife version. Pick the version that supports HomeKit but also note that once you install openHASP HomeKit support is gone.

1 Like

shelly 1 is a smart relay. But it can be configured as a smart button. Just set it to detached mode in its config.

This way you can read state of physical state using the shelly input and process it into light toggle.

you of course can still wire this shelly to be able to break light circuit. Then you can break this circuit controlling it via ha (or api). For example for your safety during light maintenance

1 Like

Hi,
I’m personally interested in a template for managing smartbulbs behind a smartrelay.
For my application it makes sense as I have plenty of smartbulbs and the sleep consumption of one of these is already 0.3W. For example I have 10 smartbulbs in my living room only which means that it takes a permanent power of 3W. I’m trying to make my house “energy friendly” as much as possible and like to put most of my smartbulbs on a HA driven power source.

Any help would be appreciated

1 Like

There is not much to it.
Put them into a smart socket, but be aware that the smart socket might use nearly as much power as the light bulbs and the light bulbs will not be controllable by HA until they are fully up and running and connected to HA again.
How they react to the power coming back on is up to the firmware in the bulb. Philips Hue bulbs can be set to a preset state for power back situation and others might just go to full brightness.

Hi,

I found the solution with light template.

- platform: template
  lights:
    gledopto_test:
      friendly_name: "GledOpto Test"

      value_template: "{{ states('switch.sonoff') == 'on' }}"  # my power supply smart switch

      temperature_template: "{{ state_attr('light.gtest', 'color_temp' )}}" # light.gtest is my smart bulb group

      color_template: "{{ state_attr('light.gtest', 'hs_color') | first }}, {{ state_attr('light.gtest', 'hs_color') | last }}"

      level_template: "{{ state_attr('light.gtest' , 'brightness') | int}}"

      turn_off:
        service: switch.turn_off
        target:
          entity_id: switch.sonoff
      turn_on:
        service: switch.turn_on
        target:
          entity_id: switch.sonoff
      set_level:
        - service: light.turn_on
          target:
             entity_id: light.gtest
          data:
             brightness: "{{ brightness }}"
        - service: switch.turn_on
          data_template:
            entity_id:
              - switch.sonoff
      set_color:
        - service: light.turn_on
          target:
             entity_id: light.gtest
          data:
             hs_color: "[{{h}}, {{s}}]"
        - service: switch.turn_on
          data_template:
            entity_id:
              - switch.sonoff

      set_temperature:
        - service: light.turn_on
          target:
             entity_id: light.gtest
          data:
             color_temp: "{{ color_temp }}"
        - service: switch.turn_on
          data_template:
            entity_id:
              - switch.sonoff