RM Rules Chasing Each Other (I think)

I have 2 outdoor lights on separate Z-wave switches. Physical wiring required separate switches. I added another Z-wave switch that doesn't directly control any load but in a spot where it is helpful to have another switch.

Anyway, whenever any of the 3 are turned on I want the other 2 to come on and vice versa. I created 3 rules, one for each switch, trigger on switch changed. Then conditional actions to turn off or on depending on the trigger state.

Problem I'm having they seem to chase each other and flash back and forth. I'm guessing the state of them is not updating before the other rules get triggered or something. Can't quite figure it out. If I change the triggers to physical change then all is fine as it only triggers if I physically move one of the switches.

But I want them to sync if I use a dashboard link, etc. Not just when physically switched.

Any ideas on what is happening here?

Can you share a screenshot of the rule that you have setup?

I wonder if the Mirror app would be helpful here instead of the rule? (It is a built-in app.)

1 Like

Agreed about using MirrorMe app, or at least separating existing RM rule into 3 sub-rules (If Sw1 Physical On > Turn on Sw2, Sw3 ... If Sw2 Physical On > Turn on Sw1, Sw3 ... etc.).

2 Likes

I looked at the mirror app and It probably would work, but would require a couple mirrors.

Anyway, I figured it out. The aux switch I am using was the issue. Apparently the switch state was not updating quick enough or something. That switch is a Zooz Central scene switch. I found out that I can look at the up or down press as a button. Then with 2 rules, if button 1 turn lights on, button 2 turn lights off. That way I don't care if that switch is on or off and thus don't have to turn it on when using the other switches.

Hope that made sense.

2 Likes

Not to belabor a point, but I still am not sure why my original rules didn't work as I thought. I have solved the issue, but still puzzled. Here is what I had originally.

Rule 1:
Trigger: Device A Changed
Actions: If A is on, then turn on B and C. If A is off, then turn off B and C.

Rule 2:
Trigger: Device B Changed
Actions: If B is on, then turn on A and C. If B is off, then turn off A and C.

Rule 3:
Trigger: Device C Changed
Actions: If C is on, then turn on A and B. If C is off, then turn off A and B.

What would happen is the devices would just keep cycling on and off. I thought at first I had a device setting wrong allowing for automatic on/off, But that wasn't the case. I checked for any other places that would control the devices, nothing there either.

Any thoughts on why this shouldn't have worked? Just for my own peace of mind.

I think a screenshot of the actual Rule(s) would be helpful here, since its/their constructions might play a part in the riddle. Logic chasing is a visual game, lol.

1 Like

Here are the 3 rules. If I turn on one of them from say a dashboard, then the 3 switches just start cycling between on and off. I changed the rules as indicated above and all works ok.

Aux Lt
Back Lt
Deck Lt

2 Likes

Nobody have any idea why these rules didn’t work correctly?

I would have to test it to know for sure, but to me it looks like they should work. Do you have logs showing what goes on when the rule(s) are triggered?

Just to be sure however, you did say that you have a solution that works now, right?

Two rules

First Rule
Required expression: private boolean=true
Trigger: any of the three comes on
Action:
Set private boolean to false
turn all three on
Set private boolean to true
Leave optimization disabled

Second Rule
Required expression: private boolean=true
Trigger: any of the three turns off
Action:
Set private boolean to false
turn off all three
Set private boolean to true
Leave optimization disabled

2 Likes

I do have a solution that works, so at this point just trying to figure out what is going on.

The only thing that showed in the logs was the devices going on and off. The one device Aux Lights is not wired to any load, just hot and neutral. It is a Zooz Zen(Forgot the number) scene controller. I am wondering if something makes that go bonkers in this configuration. Just really confusing. If I get time I might re-enable the rules and try it again to see if I can figure out something.

The final solution I ended up with actually fits what I wanted to do better as it works in a slightly different scenario which as it turns out is better for us than the original. So I guess it not working was a good thing...

2 Likes

My best guess is you're getting into a chicken and egg situation. This is all running on the scale of milliseconds. My theory:

You turn on switch A and that sends the commands for switches b/c. Those rules run based on the command but, when they check the "state" of the devices, the state hasn't updated to reflect the command and whackiness ensues. This tracks with your fix too. If that one switch was being commanded to turn on, but the state wasn't immediately showing as "on" then it would hit your "off" action instead that triggers the other devices. By the time it comes back around, that lazy switch has updated it's state, hitting your "on" action and the merry-go-round takes another lap.

Hence my recommendation above. It consolidates the rules and, ideally, the private boolean keeps the rule from being triggered again until all three switches are on or off.

2 Likes