I am building a thing that will sync a virtual switch to 3 real switches. I expect that all 3 of my real switches will turn off when i turn the front lights virtual switch off. Turning front lights on will turn all 3 real switches on.
I can turn on the front garage light real switch and the other rule turns on the front lights virtual switch -- yay. But the problem is that when i turn off the front lights virtual switch, the Event: Front Lights switch off gets logged, but no actions ran or are logged.
At 01:28:21 I turn on the Front Garage Light real switch. The other rule (app:1577) comes in and flips on the Front Lights virtual switch. everything's happy.
At 01:28:29 I turn off the Front Lights virtual switch. The rule (app:1626) logs the Event, but no rules are ran. I would expect to get in If condition and turn off all 3 real lights.
Sync Front Lights Virtual to Physical (app:1626)
The other rule seems fine and not part of the problem. they do set each other's private boolean.
Sync Front Lights Physical to Virtual (app:1577)
I tried to re-create this in a more slimmed down version, but can't replicate it. Did I stumble on something weird here?
I’m curious if you could explain what you are trying to achieve here… Maybe it’s too early, but I’m having difficulty understanding the requirement.
When I turn off the Front Lights virtual switch, I expect the Sync Front Lights Virtual to Physical rule to run. I'd be happy if all it did was log the I am Sync Front Lights Virtual to Physical message. But it does nothing.
Thanks! Could you try removing the Required Expression temporarily to see if it makes a difference?
Is there a reason you want this in Rule Machine rather than Room Lighting? If you use Room Lighting, you could create an Activator Device that would serve as a virtual switch for your three real lights.
You could also use an app to help with this. I use [RELEASE] Switch Bindings to sync switches together. You could create one instance with all four switches (3 real and 1 virtual) that would keep them in sync.
I like RM. And I'm kind of invested at this point, heh.
OK, So I deleted the original Sync Front Lights Virtual to Physical rule and re-created it exactly as it was.
All 3 of my outside lights were off and the virtual switch was off.
I turned on the Front Garage Light, and the Front Lights virtual switch turned on. Then I turned off the Front Lights virtual switch and the Front Garage Light turned off. All good. Here's the log, and it does what I expect it to do:
Just a few seconds later, without changing anything, I tried again--- I turned on the Front Garage Light, and the Sync Front Lights Virtual to Physical rule did not run. It did not even print the log message. @bravenel ?
Please state in English what it is you want to accomplish. I understand that you're wedded to RM as the means to solve this, but RM is not necessarily the right way to do this.
If what you want to do is turn on a virtual switch and as a consequence have other switches turn on, and subsequently when you turn off the virtual switch, have the same switches turn off as well, I'd use Room Lights to do that.
The rules you posted above are overly complicated for what you want to accomplish, and no doubt in that complexity lies whatever the problem is.
*changed* followed by a test on what happened is just a misuse of how things work (why throw away the information about what actually happened?).
It didn’t run again because the Private Boolean never got set back to true. I think you have an error in the Rule because the second to last log has the Boolean being set false rather than true. This is then confirmed by the Required Expression being false.
With this said, you really should look at the switch bindings app or room lighting for this rather than rule machine. Switch bindings would provide a two way sync between your virtual switch and the three real switches without the complications.
You're right, that was a bug in my re-creation of the rule. I'll be abandoning it even though it should work.