2 way switch sonoff - How to?

Tags: #<Tag:0x00007f73871dca98> #<Tag:0x00007f73871dc890> #<Tag:0x00007f73871dc688>

I’ve just set it up yesterday mine, I don’t have an issue with it, but I’ve used a slightly different rule. I don’t think it’s matters here. But my switch has a ‘cooldown’ time by default, in that time it doesn’t accept a new command to registered, so maybe that’s why I can’t reproduce this. However, I would suggest trying to increase the ButtonDebounce time, and instead of directly message the other switch, create a group topic put both switches into that topic and turn the power on and off with that topic. That might stop that effect. In your case, the problem is that the two switches can be in a different state when you changing the states. The only possible solution that I see now to reduce the latency of your network or put a cooldown so it can’t be pressed again within x second after button press (at least to change the state), where the x needs to be greater than the latency of your network from A to B to A switch. What you need to prevent is to send A switch to B to turn on while B sends A switch to turn off.

Will try the GroupTopic thing, that might help to keep them in sync. Actually, I haven’t thought about the logic of that all the way through, but yolo

The GroupTopic publishing rule didn’t work, got another infinite loop today. There is no way with Tasmota I can find to avoid this infinite loop problem, unless they give us the ability in Rules to differentiate between different MQTT topics as well as the physical switch instead of just the “power” state.

I’m moving to Home Assistant’s new automation modes to do this instead. Automations are now by default “single” mode, and you can add a sub-second delay now, both thanks to the 0.113 update. So I’ve added a delay of milliseconds: 250 to the end of my 2-way/synced switch automation to avoid this infinite loop once and for all.

I found this topic after having the same crazy switching issue with my setup too, which is similar to the OP except I have switches at top and bottom of my stairwell. Only the top switch is connected to lamps, the bottom one is connected to power but is effectively just a remote. Both are 3 gang switches.
I’m fairly new to HA and Tasmota, but I think (I hope?) I have it sorted now so wanted to share what I have.
I think the trick is only having one device ever send commands based on its power state; the other one only ever sends MQTT commands on button state.
In my setup, the rules are, for the top switch:
ON Power1#State DO Publish cmnd/StairBottomLights/POWER1 %value% ENDON

And for the bottom switch:
ON Button1#State=2 DO Publish cmnd/StairTopLights/POWER1 TOGGLE ENDON

Seems to be working so far… Will report back if it fails though!

I think that might be about the best way you could handle it. As long as both devices are not responding to and sending out messages on the same topic like I had previously tried with POWER, then I think you’ll avoid the feedback loop.

Thank you for this.

So far so good and instant!