Recursive Light Mirroring

I have a smart switch that turns on a smart light via an on/off event rather than controlling the physical load. The light is always powered. In ST, I would like the switch/light state to always be synced regardless of which one I hit. To accomplish this, I used the Smart Lighting App to enable two different mirroring routines:

Switch (Mirror) → Light
Light (Mirror) → Switch

If I tap the switch ON, I then get the light ON, and then a quick call back to the switch which is already in the ON state, so it stops.

This appears to work fine. I just wanted to check in to see if there is a downside to setting up the routine in this fashion with the slight increase in chatter on the hub. Is there a better way to synchronize a smart light and smart switch?

Just be aware that Smart Lighting will be phased out when groovy is shut down. You should start planning to move them over to Automations/Routines. Mirroring in Routines is a little bit difficult as there is no mirroring option like there is in Smart Lighting so it requires more than on Routine to achieve the same results.

4 Likes

I reimplemented it as Routines. This resulted in 4 automations to get it synced

  • Light ON → Switch ON
  • Light OFF → Switch OFF
  • Switch ON → Light ON
  • Switch OFF → Light OFF

I wasn’t able to use the "On or Off"setting since the toggling behavior isn’t deterministic.

1 Like

What’s the brand and model of the switches?

You only need 2 routines for bulb and switch synchronization.
If this is what you need?

If bulb → on or switch → on then bulb and switch → on

If bulb → off or switch → off then bulb and switch → off

I have tested it with 2 virtual switches and it works fine

1 Like

Sometimes physical switches will go into a loop condition that virtual switches will not, so you have to just try it and see.

For reasons which are not entirely clear to me, this is most likely to happen with some of the cheap Zigbee switches from China. There have been forum reports in the past about it.

1 Like

Good call. Same logic, less mess in the routine list.

@JDRoberts Zen32 scene controller, with an RF controlled fan/light combo. Since it has the fan, the load is not controlled. The main button is turning the light on/off

Yes, is possible the loop

Sorry, I’m confused. What is the brand and model of the two devices you were trying to have mirror each other?

make sure none of the devices are as precondition, then it wouldn’t work for sure

Zen32 Scene Controller and an RF light controlled with Bond Bridge

Ok, then you’ll have to go through smartthings to get the mirroring. If you have 2 zwave devices, you can use direct association to create a virtual three-way which works for many use cases. But obviously that’s not an option here.

Good point. That’s a good one for anyone that follows on later

1 Like

Since we’re documenting this for posterity :wink: , I will mention that there are very few Z wave lightbulbs that can be the trigger for association. but Aeotec does make one, ZW098-A52. Ezlo sells it in their Vera shop.

I’d expect both routines to trigger when either the bulb or switch change state so that looks like it relies on them running sequentially.

1 Like

As also said @JDRoberts with some real devices it goes into a loop

I tried this with my real devices and it works fine. The key is to use the explicit on and off states and not the “On or Off” toggle command. I verified in the debugger that it is not looping. One redundant command is sent back to the original device, but then it terminates seeing that it is already in that state.

1 Like

It just depends on the specific models. In your case, because you’re going through BroadLink, there’s probably a very slight delay which helps prevent the infinite Loop.

I did also change a setting in the Bond Bridge for the light that told it to “trust” the tracked state and not to send a redundant state to the light if it thinks it is already in the correct state. I didn’t do that for this, but to keep the fan module from clicking whenever an automation wants to turn it on.

1 Like

Glad to hear it.
I tried with some and with zigbee devices it loops and with zwave devices it does not loop