I'm going nuts... I have been trying to solve this for a year without full success
The problem: In a large bathroom with no windows I want the lights to turn on when entering and turning off when exiting. Problem is that after entering people usually are very still or in a corner not covered by a motion sensor - ie the lights go out when the should not...
I have added an open/closed door sensor and a secondary motion sensor in my quest to solve this, but it is still not working as expected.
My idea is this: If a motion sensor is triggered when the door is ALREADY closed, then the lights should never turn off, otherwise there should be a simple timer to turn off the lights.
Can some one please help with an elegant solution to this problem (without adding more devices...)
Presence sensor instead of motion detector.
Can you post your rule that you are currently using?
The easiest way to achieve this exact type of lighting automation that I have found, is to use the built-in "Motion and Mode Lighting" app.
Here is an example of my bathroom's instance of this app.
You can see the red-circled section where I use a second motion sensor to keep the lights on while in the shower.
There is an option in this app, where you can also assign a contact sensor to keep the lights on.
Using an app that is designed specifically to handle these lighting automations is much, much simpler than trying to build a Rule Machine rule to achieve the same results.
I believe the same lighting automation could also be created using the newer built-in "Room Lighting" app. I have just never bothered trying to migrate to Room Lighting as my automations already work 100% reliably for my requirements. (i.e. If it isn't broken, don't fix it! )
I have a large bathroom that is longer than it is wide. There is no way that a single motion sensor will work, Thus, I have two sensors operating at right angles. When either motion sensor triggers, the lights come on and remain on for 10 minutes. The motion sensors don't work through the shower doors, so I still have an issue with the lights turning off if my shower lasts more than 10 minutes. Fortunately, there is a humidity sensor that turns on an exhaust fan and light, so I have some light to finish my shower.
With motion sensors, you always need some type of delay before turning the lights off. The 10 minute delay works for me, but you can try making it longer or shorter as needed.
I have eleven 40 watt equivalent bulbs in my bathroom for high illumination. The bulbs pull pull around 50 watts total. In Illinois, electricity is about $0.16 per kwh, so I could run the lights for 20 hours for 16 cents, a little less than 1 cent per hour. Thus, 10 minute delays might add about $1 a month to my electric bill.
Of course, if you are using incandescent or halogen lighting, the cost will be significantly higher. If you have not already done so, switch to LED lighting.
I use this little app I wrote for this exact scenario. But folks are right, a presence sensor might do better.
Edit: for a large bathroom, I would add 3 or more motion sensors, the more the merrier. Vallhorns are $9 at IKEA
If you are using a motion sensor to turn the lights on, then use the contact sensor on the door to turn them off. I have a rule like this.
Example:
Trigger - motion sensor is active turn on lights with either a required expression or conditional triggers that the door is open.
Wait event - door contact sensor is opened
Action - turn off lights
I have a rule like this in one of my bathrooms that works great. It might not sound like it will but it will.
The system won't read the second open to turn the lights off until the door is closed and reopened.
If I am misunderstanding what you are asking to happen I apologize.
Edit:
Below is a screenshot of a test rule I just wrote. The lights come on with motion. Motion can go inactive and lights stay on. Lights will stay on until the door is closed and then reopened. Lights go off.
If you want them to go off if the door is not closed you can do if statements to make that work as well.
I tried and came pretty close, but it you leave right after entering and close the door, the lights never turn off...
Wow! This app works great! The only thing missing is to be able to set the level on the dimmers based on the current mode.
I can think of 2 ways to achieve this:
-
Set the lights brightness only once, when the mode changes. This works best with devices that support pre-staging (change light parameters while the device stays off). I use this approach.
-
Create a virtual switch device that the Lumos app controls; then setup Rule Machine rules triggered by the virtual switch that control the actual lights (on/off, brightness, etc.).
You might also consider [RELEASE] Contained Motion Zones, which creates a virtual motion sensor based on contact sensors at boundaries. The idea is that if the door is closed, the person can't have left, so if there was ever a person in the room, there is still a person in the room until the door opens again, no matter how still they are at the moment.
I use this for bathrooms and bedrooms quite heavily, since the doors are often closed.