Keeping a light relay in sync with itself (digital and physical switch's)

I've got a cheap sonoff zbmini (no config options within hubitat to change the use of it). It logs a physical switch and also a digital that i'm using hubitat to turn on and off too based on rules. What i'm finding is that they go out of sync with each other. I've tried the binder app but that requires two different switch from two different modules. I think i need the mirror app but dont know how to set it up properly to work on the same switch. Anyone else managed to solve something like this at all? thanks

Not exactly sure what you mean by a digital switch because I am not familiar with the device, but it is very easy to set up a rule to keep one device in sync with another as long as you can read back the status of both. I use Webcore for most of my automations but I am sure you could do it with Rule Machine (and maybe even Basic Rules) doing something like this (written in pseudocode to get the point across). In general, I decide which device is going to be the master but in some cases, I sync both ways as either device may be changed and I still want them to sync up. This may take two rules in RM but I can do it in one Piston in Webcore.

Trigger on device.physical changing and then <- device.physical
Trigger on changing and then device.phyiscal <-

Don't know if this will be helpful or not, but here is a piston that keeps two switches in sync.

The solution above assumes that both devices accurately report their current state. I have one device (a ceiling fan light through the Bond Bridge) that only allows toggle and does not accurately report its current state. What I did there is to make the wall switch the master (and try to never have anything directly talk to the light device) and have all my automations use the wall switch device to control the light. Then in case they do get out of sync, I added a function to toggle the light itself in response to a triple-tap down on the wall switch. That way if they get out of sync I can easily manually fix it so that they get back into sync. Here is that piston (you can ignore the last trigger as that is using the same paddle as a scene control button to turn everything in the room off):

Thanks Bruce, I was trying to keep it all in rm as i don't have web core installed. I probably could do like what you said and just have the device a lone ranger with nothing else speaking to it

Does the device have a refresh command available? If it does, you could always add a refresh command to your rules after the device has been used.

1 Like

might be a way will test and see if it works sending the refresh command