So here is the crux of the automation I would like to accomplish with RM and the scenario.
When I walk into my bathroom have the lights come on (motion) and then turn off when there is no motion for 3 minutes. (see the rule to turn on the lights).
When I walk into the shower, have the shower lights turn on and change colors every 60 seconds (see the attached rule).
I am running into difficulty in the area of getting the color change loop to stop. I have set the rule as follows:
Bathroom lights turn on when motion triggers and private boolean bathroom = true.
Shower lights turn on and set private boolean bathroom to false when shower motion sensor is triggered. (this disables the bathroom lights with motion if the shower light is on).
As part of the shower light rule I run an action called random shower light which delays by 60 seconds, changes the color and executes random shower light 2. Random shower light 2 delays by 60 seconds and executes random shower light. In essence the two actions bounce back and forth between each other.
Here is my challenge: How can I stop the lights from changing randomly
Assuming your motion sensor in the main bathroom area resets while you are in the shower, then use it also to trigger stopping the random shower light. Use the random shower lights rules' private Boolean as a restriction that disables them. Then the issue will become how to re-enable them (set their private Booleans back to true). That could be an action of the main bathroom motion becoming inactive (or the false side of your main bathroom rule).
Main rule:
condition: motion active
rule: motion active
true actions: turn on light, set shower rule PB to false
false actions: turn off lights after x minutes (cancellable), set shower rule PB to true
Shower rule:
condition : shower motion active
rule: shower motion active
true action: start color bounce and set PB to true
false actions: turn off lights after x minutes (cancellable), set shower rule PB (and second one) PB to false after x minutes (cancellable)
If motion is detected in the shower and the shower light turns on... what boolean disables the main rule so the bathroom lights do not turn on while taking a shower.
You want only one "Light" on at a time, right? So the booleans are "cross connected" The boolean for the initial rule is "managed" by the 2nd rule and visa versa. That can put you into a situation where they are both off and nothing will turn on ever again. I think that's what Bruce was saying when he remarked: "Then the issue will become how to re-enable them (set their private Booleans back to true). That could be an action of the main bathroom motion becoming inactive (or the false side of your main bathroom rule)."
You'll have to explain more or figure out what resets the booleans back to their initial state. (Third rule? when motion is stopped for 8 mins?)
I don't know what your setup is. In my case I always put motion sensors in showers. Also, our preference is for the main bathroom lights to stay on during the shower. But, that's mainly in bathrooms where the main lights ARE the shower lights also, and the extra motion sensor is needed to keep the lights from turning off.
But if you have a shower that is separated, and has it's own motion sensor, then the other bathroom lights could just turn off when there is no motion outside the shower area. The re-enabling of the shower color bounce lights could be on a delayed action, kicks in after some number of minutes. Or you could disable both bounce rules when the shower motion goes inactive, then re-enable it later.
That's the issue. How can I reset things back to normal.
In ST webcore land, I simply used variables and motion would only trigger when a variable was true.
This is similar in this case because I can enable bathroom lights when there is motion AND PB = true.
If shower motion is active the Bathroom Light PB can be set to false but how do I get the bathroom light PB back to true?strong text when I get out of the shower?
I'm thinking that Rule #3 would fire off no-motion on your bathroom sensor and reset the Boolean. Thus as you "cross" from the bathroom into the shower, the room lights go on, then the shower, then the room lights go off and the boolean resets ready for more motion for the "cross" back through the bathroom and out.
question wasn't to me, but I have an opinion anyway!!
Over on ST I did everything in WebCoRE, but when I arrived here, it hadn't been ported yet, and RuleMachine did everything I needed. Yes, I had to convert/translate/reorganize my brain, but really, programming is programming. Once the logic is figured out, it's just implementation variance.
Programming is so much faster when you have the language memorized, but the logic is fundamentally the same.. at least for me.
But if they are turned on by motion, why do you have to "prevent" them from coming on? There won't be any motion to turn them on because you're in the shower. Don't you want them come back on when you get out of the shower? I don't see why you need that PB on that rule.