Why Is My Rule Slow?

When I walk into my bathroom, it takes 2-5 seconds for the lights to come on. Did I make a mistake here in combining all of my desired actions into a single rule? Can this rule be optimized?

Ideally, motion will trigger:
-lights will come on at 20% early in the morning and slowly increase to 80%.
-if the motion detector can't sense me (b/c I'm in the shower), then if I reactivate the sensor then lights will come back on directly at 80 without having to fade up again from 20 (via the local variable).
-lights come on at 80% during the day
-lights come on at 20% and stay at 20% late at night.
-when motion isn't detected, a 10 minute cancellable timer starts before the lights are turned off.

I see you are logging the app triggers. Are you also logging the Main Bathroom Sensor and the Main Bathroom Lights?

Where are the delays in your logs? That will help determine the source of the delay.

It could be the rule, but also could be that the sensor is just slow to react / send the information to Hubitat… It could also be that the command takes time to get to the switch due to problems with the connection to it (Ex.: Z-Wave mesh issues).

Thanks! I'll check the logs the next time I trigger the Aeotec Multisensor 6 in the bathroom.

You only test for motion active in the very first conditional, so the others are going to turn on even if it's inactive.

At a minimum, lose the motion changed trigger and the test on the motion state. Also lose the final ELSE-IF, and all of the Cancel Delayed Actions. Trigger on motion active, and at the end of the long conditional, use Wait for Event: motion inactive, followed by Wait for Event: Time Elapsed 0:10:00. Wait for Events is auto cancelled if the rule is triggered.

Then see what the logs show about time between motion event and lights on event. Turn on action logging in the rule.

1 Like

Perhaps the system is simply overloaded with functions? Maybe it makes sense to split the general process into several threads, to carry out some kind of decentralization? Maybe if you use less information each time, the system will process the request faster?

Bathrooms can be very unfriendly to radio signals. You have mirrors that block or reflect signals. You have electric wiring, water piping, HVAC and exhaust vent ducts in the walls, floor, and ceiling. In my master bath, I had a tough time maintaining Z-wave connections, so I replaced my Z-wave motion sensors with Zigbee. My lights are controlled by Lutron Caseta Clear Connect which has been reliable. Also Zigbee motion sensors tend to trigger faster than Z-wave; at least that is my experience.

I use a basic rule to trigger my bathroom lights. If the motion sensor triggers, it turns the lights on to 50%. If I need more light, I can adjust the dimmer manually. That would occur only when I am shaving or my wife is putting on makeup or trimming her eyebrows. The lights will turn off after no motion is detected for five minutes, although that could be adjusted. I have the rule restricted so it only functions during normal waking hours. I do not want the lights coming on at 3:00 am if I have to use the toilet, a night light is sufficient for that.

My motion sensor is aimed at the bathroom door. By the time I enter the bathroom, the motion sensor has detected my movement and turned the lights on.

Also, if you tend to keep the bathroom door closed, you can use a contact sensor on the door as a trigger as well. If the contact sensor opens, the lights will come on. I do that with the door between the house and the laundry room. Although there is a motion sensor in the garage, it is slow to detect movement coming from the house into the garage. The contact sensor resolved that problem. Now the lights are on before I set foot in the garage.

I will ask a silly question, but did you try this in Motion Lighting, or maybe even a community based app like Lights On Motion Plus? LOMP in particular has lots of features, and works excellent. [RELEASE] Lights on Motion Plus (dim before off, remember individual bulb states, etc.)

3 Likes

I'm trying @bravenel 's suggestion. Will report back tomorrow after testing each of the time slices...

1 Like

You could also just try a very simple rule to see if the response time is improved. If a simple rule is slow, then most likely either the device or your mesh is the problem.

For example, try something like if motion active, turn on lights. If that simple rule is speedy, then follow Bruce’s instruction to improve your rule.

2 Likes

Sounds great. These are really good, helpful solutions. You are great for looking for an alternative to motion sensors and making your home more functional. By the way, a question. Does the light go out when you close the door when you walk into the garage? I don't think you work with an open door. As I understand it, the contact sensor turns on the light for the first opening-closing, and turns it off for the second time?

I have a cat who is determined to get out into the garage, so keeping the door closed is an absolute must. She is pure white so I do not want her brushing up against car tires or greasy parts.

I have the contact sensor set such that the light comes on when the door is opened, but will go out after five minutes if the door stays closed and no motion is detected. If I am working in the garage, the motion detector keeps the light turn on until five minutes after motion ceases. I plan to add a second motion sensor to make sure the light does not go out if I am working on the far side of the garage where the primary motion detector cannot see me.

@bravenel 's suggestion worked great. I tweaked it a little bit, but now I know how to better structure my rules. Thanks to everybody for the suggestions!

2 Likes