Hello, I’m wondering if someone can help me write a simple code for a contact sensor, I’m happy to reimburse for the time, considering I can’t really offer much else .
Im looking for a door contact sensor to turn a light or lights on when a door is opened, but turn them off when a door is closed a second time with in a specific amount of time that could be entered on the smartapp (considering the first time a door is closed would be when someone goes into a room and closes the door initially). I would also like to add a scheduling ability as different lights would need to be triggered during day or night.
I’ve tried literally every function thats built in and even some smart apps. The main thing I need is the function of a contact sensor causing an off action when closed the 2nd time. Basically this would be for a bathroom, Ive come to understand that motion sensors don’t work because they dont detect motion while someone is showering, humidity sensors work but it takes too long for humidity to drop down for actions to occur, so that left me with the current idea which it seems would work flawlessly.
Your best bet is still motion sensors. The door opens and then closes scenario breaks when someone goes to the bathroom just to drop off some towels and does not shut the door. The next person after them will open and close the door and the lights will be out.
You just need to set a large time window for turning the light out after no motion is detected. Detecting humidity would also work for when someone is in the shower. The bathroom is one of the places I don’t automate. Your partner will not appreciate getting out of the shower in the dark. My partner for example wants absolutely no light on when she goes to the bathroom at night. I automated our guest bath, but not the master bath.
I’ve actually had a lot of luck with my bathroom — I use a ceiling mounted motion sensor that picks up the shower, toilet area, entrance, sink. During the day, it turns on the all the lighting, and at night, it slowly dims up a cute ikea moon lamp with a very low wattage bulb over the toilet.
I’ve set the dip switches on the motion sensor to be highly sensitive and it only turns off after five minutes of inactivity. Seems to work. In fact, it’s the most reliable part of my ST setup.
If it was not clear, I just spoke with @borya on the phone, and what he wants is for when someone enters the bathroom and closes the door the lights are. After some amount of time they exit the bathroom and the the lights turn off. He wants this to work using a door contact sensor and a motion detector. So the motion detector will take over anytime the door is open and the contact sensors will turn the lights on and off based on open close events.