[RELEASE] Switch Bindings


Switch Bindings app for Hubitat

An app for Hubitat that binds two (or more) switches/dimmers together. When bound, if either one turns on or off, the binding will make the other one also turn on/off. It will also sync dimmer levels, if any of the devices are dimmers. (It works a lot like a z-wave association, but it happens in the Hubitat hub, so that the hub can know/display the updated device states. Because the Hubitat is local, the binding can happen effectively as fast as z-wave messages can travel.)

Examples of Usage

  • Suppose you have a smart wall switch in your living room that controls the overhead can lights. Now you add a lamp in the room, and you either put a smart bulb in it, or plug it into a smart outlet. (In either case, the controls aren't super accessible.) You can use this app to bind the wall switch and the lamp together, so that all your lights will always turn on and off together. They will stay synced whether you control them using the wall switch, an app, or Alexa or Google Home.
  • 3-way and 4-way lighting controlled by software, not wiring in the walls
  • Sync a fan and a light switch
  • Sync levels across a roomful of dimmers
  • With a 5 button scene controller keypad. My driver exposes the buttons/lights as virtual switches. By using Switch Bindings alongside this, it becomes easy to keep lights synced with the scene controller. See my keypad driver here: https://github.com/joelwetzel/Hubitat-Cooper-Aspire-Scene-Controller


The best way to install this code is by using Hubitat Package Manager.

However, if you need to install manually:

  1. On the Hubitat hub, go to the "Apps Code" page
  2. Click "+ New App"
  3. Copy in the contents of SwitchBindings.groovy
  4. Click "Save"
  5. Click "+ New App" again
  6. Copy in the contents of SwitchBindingInstance.groovy
  7. Click "Save"
  8. Go to the "Apps" page
  9. Click "Add User App"
  10. Click on Switch Bindings
  11. Click "Done"
  12. Click on Switch Bindings in your apps list
  13. Click on "Add a new binding"
  14. Choose your switches to bind
  15. Click "Done"
[RELEASE] Dimmer Sync
Using Mirror Me in place of Z-wave associations
3-Way Switch Control
Smart switches AND smart bulbs how to?
Composite Child Devices and Dashboards (HBFC)
Groups of Switches
Proper 3-Way Switch Configuration Help
Control 3 Switched Lights Together
Hubitat - Govee & HomeKit Integration (Color & Dimming?)
Replacing 2 smart bulbs in the hall with a switch soon and have an issue
[DRIVER] Zooz ZEN Switches Advanced (and Dimmers)
[RELEASE] Home Assistant Device Bridge (HADB)
Zooz ZEN72 dimmer with Philips Hue bulbs and Hue v2 remote
Zooz ZEN 72 dimmer association group doesn't work with double tap
Virtual Devices For Real devices resource consumption?
Custom Apps [Wiki]
Use two switches to simulate three-way circuit
Keep 2 light switches at sync
Zooz and smart bulb - how to get rid of the delay?
Qubino custom driver and Google Home Integration
Rule machine or mirror for dimmers
Can I use a smart dimmer to drive a dimmable smart plug? (and how?)
Turning a group of lights on or off from any of the switches?
Mirror me issue
Binding Switches together
Aqara double-relay for old roller shutter setup
Inovelli z-wave association tool troubleshooting
[RELEASE] IKEA Tradfri Puck driver
Tradfri dimmer
What Action(s) to set a Dimmer Level = to another Dimmer Level?
Turning off/on second switch based on first switch
[RELEASE] GE/Jasco Z-Wave Plus Dimmer Driver
Mirror Me not working for GE Smart Fan Control
One dimmer to control another
Simple dimmer and light control
Auto shut off water valve
What is the best way to group Z-Wave Dimmers (or Fans or Switches)?
Fan Speed Capability as a Condition/Trigger
Gate Controller
Question about grouping switches
Keeping separate dimmers in sync
Mirror Me Generating excessive hub load
Is there an easy way to keep a physical switch and virtual switch in sync?
No firmware updates?
Mirror dimmer - easiest way
Mirroring Virtual Fan to Physical Fan Controller
Smart switch to control smart bulb - direct association vs rule machine
Rule Actions Not Running but Event is logged
Figured out a Simple Way to get Zooz Zen30 Combo Fan/Light to work correctly in Google Home
Can't get my wifi switches (TP-LINK KASA) to execute rules from the physical switches, only works on app
How to set associations for 2 zooz dimmers in a smart 3 way setup

Does this bind dimming levels as well or only switch state?

Right now, only switch state, not dimming levels. That would be an interesting next step in its development though.

1 Like

Thanks!, interested in dimming too, also, is this bi-directional?

@Cobra has an app for this too but is unidirectional. I believe when using Z-Wave Plus devices that report physical vs digital state changes it should be possible to do bi-directional sync...

Yes, this is bi-directional.

1 Like

My Dimmer Sync app does dimmers (on/off and level), but it is intentionally unidirectional (master/slave[s]).

What?!? I'm so confused. What difference does it make if it's z-wave plus or not? It's just syncing two devices with each other. Won't matter what type they are or how they changed, at least from my understanding.

Looking at this code, it needs to know how long it takes for the follower switch to turn on/off and return status - so that state changes are ignored during that period.

Since non-plus devices don't report instant status, you would have to make sure the response time setting is long enough for the non-plus device to report back its status (presumably via polling).

1 Like

I don't actually have any non-plus devices, so my switches report back very quickly. But I have two dimmer plugs that behave "interestingly". One of them reports its new status right when it starts to dim to it. The other one only reports its new status after it has finished dimming - which could be 3-5 seconds.

So imagine this:

  • I turn on Switch1
  • The binding turns on Switch2 (which is actually this dimmer)
  • After 3 seconds, Switch2 reports its new status

So, should the binding try to do anything on Switch1? It won't hurt switch1 to try to turn it on, since it's already on. The hub won't even send out any z-wave messages to it. BUT... what if you had turned Switch1 off in that time? For example, you turn it on and instantly realize it was the wrong light and you want it off. Then we definitely don't want Switch2's late report to go back and force Switch1 back on again.

That's what the time tracking is for. But it's not a setting you'd need to fiddle with unless all of these were true:

  • One of the switches is slow to report its status back
  • and you regularly physically toggle BOTH switches, one right after the other (which is hard to imagine wanting to do)

Basically the timer just makes the first switch that you interact with into a quasi-"master" for a couple seconds.

1 Like

There's definitely a lot of ways this could be extended to cover more use cases, and more capabilities than just 'switch'. I don't know if I'll be the one to develop those extensions though. Right now I've optimized it for "simple, reliable, and fast" for just the purpose of bi-directionally linking two switches.

My own use case is to use a Cooper Aspire 5-button Scene Controller to control several lamps in my living room. I used to be on SmartThings, and used webCORE to make it work, but it wasn't simple, it wasn't reliable, and it really was not fast (since everything went out and back to SmartThings servers several times). But now that I'm able to have my code run directly on the Hubitat and stay local, my button controller and lamps are super fast. It's a night-and-day difference.

1 Like

What does this get you that the built-in Groups and Scenes app doesnt already?

Unless I'm misunderstanding its functionality, Groups and Scenes creates a virtual button that you can press to turn on/off a bunch of stuff at once.

But in my case, I have a button controller on the wall that I want to bind to a floor lamp. With my switch bindings, I can:

  • Push the button on the wall, and the lamp will come on.
  • Say "Alexa, turn on the floor lamp", then when the floor lamp turns on, the indicator light on my button controller will also turn on.
  • And if I have other scenes running on timers (such as turning off all the lights at night), then the indicator lights on my button controller will stay synced with the actual state of the house.

The important part is that it doesn't matter whether physical or virtual events cause one or the other to change. No matter what, they stay synced.


That is what I was thinking. Groups/Scenes does this and dimming PLUS zwave and Zigbee device grouped together. It sure the value proposition here.

1 Like

This app should work with zigbee. I mention zwave because that's what I have, but there's nothing in the app that's zwave specific. It will work with anything with capability 'switch'.

You say groups/scenes does this? Does it do the bi-directional part?

Ok, I just tested and Groups and Scenes does not perform the same thing I'm doing here. Definitely has its own great uses. But it creates virtual devices, and then on/off commands on the virtual devices are sent out (uni-directionally) to the selected devices in the group or scene.

What I'm doing here is binding two existing devices (physical or virtual, doesn't matter) and bi-directionally syncing them.


Very cool... +1 on the dimming feature. That would be awesome.

Great app! I use a few different ways to operate lights, this keeps them nicely in sync!
Many thanks! :+1:


In the first version, a binding could only bind two switches together. With this update, each binding can include an arbitrary number of switches. Do 3-way and 4-way lighting via software.

If you've already installed it, you'll need to re-copy in the two groovy files. I'm not sure if you can do that while leaving existing bindings in place. They may stop working. For this reason, I've tried to make it very fast to configure the bindings.

Get it here:


1 Like

Imported both, and re-assigned the switches and lights, working a real treat!! Many thanks for the app, I think its great!

1 Like

New update: Fixed some bugs. Only SwitchBindingInstance.groovy had updates.

(This is one thing I miss from SmartThings. Github integration. Wish it didn't create so much work for users every time I need to make an update.)

1 Like

Download the Hubitat app