Using Smart Switches with Smart Bulbs

A few of my people have asked me if it was possible to use both smart switches and smart bulbs in the same place.  

At first I couldn’t think of any reason why you would want to do that.  If you use a smart light switch, or any light switch in that matter, to cut the power to your smart lights then they will lose connection to your home automation system and be utterly useless.  What’s the point?

After thinking about it a bit more, I came up with some use cases and ideas that made perfect sense.

For example, I wanted one of my ceiling lights downstairs to turn green when my washing machine was finished.  That way I knew, when I walked past the closed off laundry, that there was a load of wet clothes in my washing machine waiting to be emptied.

I also wanted to individually adjust the colour and brightness of these lights in my office so that they created the perfect conditions for filming these YouTube videos.

These smart bulbs actually draw power when they’re switched off, so I also wanted them to be totally powered off when I’m asleep, or not home, so I’m not wasting energy.

And finally, if my smart home system or automations broke, then I wanted to make sure that I could keep using the lights as normal by pressing the switch.

Some smart switches and relays allow you to separate the physical switch button from the relay inside that actually connects and disconnects the power to the bulbs.  

The advantage of this is that you can use the physical switch to trigger things inside your smart home platform without affecting the power flowing through the switch to the lights.

This also means that when my lights are “off”, the smart home system can turn them on in any colour, level of brightness and any configuration.  Rather than having all my lights turn on to white when I turn on the switch which is what happens with a normal light switch, I can activate a scene that sets them each to a different colour and brightness level.

Aqara H1 Switch Decoupled Mode

In my smart home I use a lot of Aqara H1 Zigbee switches, as well as a few Candeo Zigbee dimmers.

The Aqara H1 has a feature called “Decoupled Mode” which you use to separate the physical switch from the relay.

You can set whether or not a switch is in relay mode, which is the normal mode of operation where the switch controls the power to the bulbs, or decoupled mode inside the Aqara app if you’re using their ecosystem, or inside Zigbee2MQTT if you’re using that. 

Unfortunately, at the time of recording, you couldn’t set the option if you’re using the default Home Assistant Zigbee home automation integration known as ZHA - hopefully that will get added one day soon.

Shelly Relay Detatched Mode

These can be configured in a similar way using something called detached mode.  That can be done by visiting the IP address of the Shelly in your web browser.

Home Assistant Automations

In these modes my ceiling smart lights will always have power sent to them, regardless of what I do with the physical switch.

I can now create an automation in my home automation system, in this case Home Assistant, to do something when you press the switch.  And to do an entirely different thing if I double tap the switch.

In this automation I have two triggers, one for the single tap action and one for the double tap action.  Each of these triggers has a unique trigger ID specified here so I can use a single automation for both the single tap or double tap action.

If you don’t want to faff around with this, then it’s much simpler to create two separate automations, one that is triggered by a single tap action and one that is triggered by the double tap action.

The action of my automation uses a choose to do one of two things, depending on how many times the button was tapped.

If I press the button once, it will toggle all the lights in my office - either switching them on or off. If I press the button twice, it will activate my Normal office scene, which sets all my pretty back lights up and such.

Here’s the full automation in YAML:

alias: "Switch: Alans Office Light Switch"
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: 689fe63e4c0e4c9115f4aa7a3ab0df45
    type: action
    subtype: single
    discovery_id: 0x54ef44100063ac61 action_single
    id: Single
    alias: Single Tap Trigger
  - platform: device
    domain: mqtt
    device_id: 689fe63e4c0e4c9115f4aa7a3ab0df45
    type: action
    subtype: double
    discovery_id: 0x54ef44100063ac61 action_double
    id: Double
    alias: Double Tap Trigger
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Single
        sequence:
          - service: light.toggle
            data: {}
            target:
              entity_id: light.alan_office_all_lights
      - conditions:
          - condition: trigger
            id: Double
        sequence:
          - service: scene.turn_on
            data:
              transition: 5
            target:
              entity_id: scene.alan_office_normal
mode: single

Turning off the smart bulbs to save power

Each of these smart GU10 light switches uses about half a watt of power when they are switched off and on standby.  

That may not seem like a lot, but if we do some quick math we realise that each bulb uses around one third of a kilowatt hour a month on standby.  In my office I have 6 of these bulbs, and at 45 pence per kilowatt hour we can deduce that leaving these smart lights on costs me

One british pound per month.  That’s not a lot. 

But, because I can, I’ve set up an automation that physically turns off the relay and disconnects the power to these bulbs when there’s no one detected in the office.  It turns the relay back on again when I walk back into the office and there’s motion detected.

Automation to disable the ceiling lights when office is empty for an hour

Automation to power up the ceiling lights when office detects motion

Previous
Previous

Home Assistant Wall Panels with a Tuya S6E

Next
Next

Curtain and Blind Automations