I'm trying to automate my bathroom light without a motion sensor because it's a "public" bathroom and people confuse the motion sensor with a spycam and kinda freak them out.
So my idea is to turn on lights when contact sensor opens and turns off when contact sensor closes for the second time (first close is for the customer to get in and the 2nd when they get out) with an exit/cancel rule if the customer manually turns off the light before leaving the bathroom.
I see a lot of great automations but using motion sensor but I can't figure it out how to do it the way I explained.
I'd be wary of relying on a sequence of events, only because if someone does something unexpected and opens the door the second time to then go back in, the room will be dark. Another scenario could be someone coming out and holding the door open for the next person. That may or may not be a likely scenario in your case, but I know it can happen for me at home, so have avoided using a string of events like this.
That said, if you do want to do it, without having done it myself, I am thinking you could use an RM rule and it's built in private Boolean and a required expression.
Set the Required Expression to be when the private Boolean is false.
Set the Trigger for the rule to be the opening of the contact sensor.
Set the Actions to be:
Set the private Boolean to true
Turn on the light
Wait the Open Contact Sensor event
Wait for the Close Contact Sensor event
Turn off the lights
Set the private Boolean to False
Can't say for sure it will work, but may be a good starting point.... And I realise I haven't built in the manual control of the lights...
have you considered the motion sensor being outside the room? You could ceiling mount ... if necessary create a shield so it only triggers in a narrow area of motion detect.
I have GE/Jasco motion switches in both bathrooms.
They work great.
They're built into the switch, just like you see in practically every public bathroom.