Rule Machine - Get peer assistance here with setting up rules

New ST owner here. It started with a few Hue bulbs and things escalated from there! On the topic of bathroom automation (I like the motion sensor idea for exhaust fan and overhead shower light). With regards to bathroom lighting…I had wanted to automate the main lights in the bathroom. I am going to be a father soon (at 44…better late than never) and like any other first time dad I tend to overthink things! For nighttime trips to our ensuite bathroom I plan on having my multisensor detect motion just inside the door and have the lights come on dimmed. This works well but setting the color of the light doesn’t (another topic). I would then set a private boolean occupied to true. A separate trigger initiated by the bathroom door opening (AND occupied is true) would then turn off the lights. Does this sound correct or could there be a better way? Obviously if the door doesn’t get closed the switch will have to be used (and I’d have to have another trigger that responds to turning the switch off by setting occupied to false). Thanks! Sean

I was trying to understand how the Rules Machine logic sequence works on controlling my 3 speed ceiling fan with the GE 12730 Z-Wave Smart Fan Control. Ideally I only want to change one setpoint temperature and every two degree increase trigger the next higher speed. The question is there a better way to do this than the way I did with three rules each having its own setpoint? I think it is possible my 3 rules are conflicting with each other because when I get to trigger on the next higher speed i.e. Medium speed this Fan 2nd Stage Cooling rule sets the device to 70% doesn’t the Low speed Fan 1st Stage Cooling rule try to keep changing it back to 25%? I am thinking this because in the second rule when have no actions for False what actually will reset the speed level to 25%? I may not be understanding the logic trigger point actions correctly.

FYI; The actual installation details are in this discussion Control 3-speed Ceiling Fan and Light Kit:

The way you have it they will conflict with each other, since >= 75 makes >= 73 also true. Plus, in the first one, you must have changed the condition at some point but not updated the rule definition, as it says 69.

So you could do this with ranges using two conditions:
first rule: >= 73 AND < 75
second rule: >= 75 AND < 77
third rule: >= 77

That way, each rule would have a unique set of conditions, and only one of them would fire instead of more than one.

That makes perfect sense. Thanks!

On the first one I did a test to see if the fan would turn on so I temporarily set it to 69 and the fan did indeed trigger. I went back in to the Define Rule and resaved it and it changed the description. Do I need to do that every time I make a change in the condition (setpoint) to remember to go down and do a resave in the Define Rule as well?

UPDATE: Interesting little “bug” as I was in the process of modifying the existing rules. The first rule went just fine. As I was doing the second rule I tried to back out due to a mistake I had made. Now I can no longer even look at that particular rule. I get a red “You are not authorized to perform the requested operation.” flag any time I try to open that rule up. The others are still ok

It’s not just re-save, it’s re-define. Once you change a condition, the old condition is gone. However, the rule doesn’t know that. So the rule has to be redefined.

It is a weakness of Rule Machine (actually, of ST), that changing things can upset the apple cart. It’s always best to remove a rule rather than change it (unless you know exactly what you’re doing).

Got it. Thanks for the reply.

I’m in the process of removing Rule smart app. This weird “You are not authorized…” isn’t clearing after I log out and log back in. I don’t know how else to dump the second rule I messed up some how.

If you are on iOS, just swipe left on the rule. If Android, use the IDE to remove that rule:

In the IDE, go to My Locations / List SmartApps / Edit (upper right corner) / scroll to that rule and Uninstall.

I have all three platforms available to me. On iOS if I try swiping left on the actual Rule#2 or Rule#1 that is still accessible, nothing happens? I checked and noticed I was not running the latest app ver so I am updating now. I logged into IDE and that did it! I didn’t realize that was there in IDE… nice. :grinning:

You need 2 rules for this I think.

First rule for the motion and switch combined

Conditions
Bathroom Motion Active
Private Boolean:true

Rule
Bathroom Motion Active
OR
Private Boolean:true

Actions for True
Bathroom Lights on

Actions for False
Pending Off: Bathroom Lights: 1minute

Then the rule to set the boolean to true when someone is in the shower could go something like this.

Trigger Event
Shower Door Open

Conditions
Private Boolean false

Rule
Private Boolean is false

Actions for true
Rule Boolean: (the name of this rule)(the name of the other rule you create for this): true

Actions for false
Rule Boolean: (the name of this rule)(the name of the other rule you create for this): false

If I am doing this correctly, then when you walk into the bathroom the motion sensor will turn on the lights. Then the first time you open the shower door it will set the boolean so that the lights will stay on. Then when you open the door to get out of the shower, it will set the boolean the other way and will allow the rule to run again with motion only. Once there is no motion for 1 minute the lights should turn off.

If someone opens the door while in the shower but remains then this will fail, but they should be able to just open/close the door again to resent it.

Thanks for input and nice try! That’s exactly how I started too, but then I realized that all I need, is "toggle shower light when contact opens :slight_smile: Now, like you said, if someone opens the door multiple times, then the rule breaks. For now I “trained” my wife to open/close the door if the light is not on. It works!

So you have one rule to turn the light on/off with the shower door, and another for the motion?

I was going to post my problems that I’ve struggled with for 3 weeks and ask for help. Instead I post my solution (or tip on how I solved it).

My rule isnt working …
so instead of modifying the rule and doing trial/error on real devices; I made virtual devices for my items. Testing turn around time was much faster; and problems in logic were detected much sooner. Hope this help people.

Good idea. It took me a while to figure this out. I was out driving around the block to test presence sensors. Bad!! :grinning:

3 Likes

Correct…Motion active on, pending cancel inactive off after 1 min. If you take a shower, only the shower light stays on, unless someone else comes in. When you open the door, the shower light turns off and the main turns on. Works well, but the tricky part is that we both “warm up the water” so the sequence is more like open/close, open/close shower open/close. And I had that part worked out with priv bool, but the other day my wife forgot the towel after warming up the water, so she introduced another open/close into the mix. :slight_smile: Because we are humans, I cannot predict the unpredictable :slight_smile:

What about putting a motion sensor up in the corner of the shower. Set it to detect the door opening and while in the shower.

Use some silicon to seal up the sensor really good and it should work out for what you want.

You can have the rule turn on the light when you cone in the bathroom and the sensor in the shower set to keep the light on while you’re in there.

Sure, but instead of using a good silicon, I’ll be using this - I have one coming in 2 days :slight_smile:

Ummm… Really bad art work?

1 Like

No really… What am I looking at? ? ? ? Lol

A better shot…The Aeon Labs 6 sense gen 5 sensor :slight_smile:

Oh my! Now motorized that bad boy so it can follow you around the room! The wife will love that inn the shower! Oh! And paint it to look like an eye!

2 Likes