Bought the Starter Kit - using Lights with Motion Sensors?

(Jay) #1

Hi all,

Yes I bought a starter kits, plus an AEON micro switch, plus an AEON smart plug.

But then still unable to decide what to do with them…

  1. I have an idea of auto turn on the light in bathroom, by using the motion sensor. But then how to make it auto turn-off when the person left the room? No-motion-detection won’t work because people may lay/sit still in the bath tube/toilet for a couple of minutes.

The same dilemma for using it in the kitchen. I just don’t want the lights to auto-off when there’s still people around, but not moving.

  1. For security - I intended to set up sensors (door, motion) at the root entrance. However using a siren is too much of an overkill. Other than a siren, is there any better solution to alert me via my mobile phone, and is loud/noticable enough to wake me up at night, but not the whole neighbourhood?

Those are for the start. If I can be successful with them then I will have permission to buy/do more with the house.

Quieter Security Alert without a Siren?
Suggestions Needed - Bathroom Motion
(Kyle ) #2

If your looking for an out of the box solution without a complex written smartapp, you can easily setup delays for the lights turning off due to lack of motion in switch preferences, for example:

Turn On “BATHROOM LIGHT” when motion is detected on “BATHROOM MOTION SENSOR” then Turn Off “BATHROOM LIGHT” -“5 MINUTES” after motion is no longer detected on “BATHROOM MOTION SENSOR” . . .

I hope this helps.

(Keith Croshaw) #3

Check out
A little low on user interface but it’s out of this world when it comes to functionality.

(Jay) #4

Thanks guys .I also thought of some delay but that doesn’t seem like a “genuine” or" designed" solution. How about a complex written smartapp? What can I do without adding more devices?

(Kyle ) #5

@JDRoberts is always good at working out more complex solutions ive found @tgauchat also . . .

(Keith Croshaw) #6

I think delay is the best way to go for auto off, simplerulebuilder has a delay function for each “block” you wish to add.


I personally don’t use “turn off after inactivity” logic for exactly the reasons you gave–too easy to turn the lights off too soon. Bathrooms are particularly problematic because people taking baths rarely register on motion detectors. So I’m not the right person to contribute on this topic.

@bravenel and @baldeagle072 are grandmasters on the use of motion sensors and lights and have written code for many different use cases. Hopefully they’ll chime in. :blush:

Also @rayzurbock has a smartapp for just this purpose. Much discussion in that topic, although I think he’s been working on other projects lately. He added a humidity sensor to solve the shower problem, which was an interesting approach. Anyway, the topic’s worth reading.

And the following topic had much helpful discussion of motion sensor lights in the kitchen.


BTW, It’s much easier for conversation if you use each thread for just one topic. I’ve split out your second topic: please continue the security conversation there. :sunglasses:

(Bruce) #9

It doesn’t take a lot of motion to trigger one of these. You can set how long after motion stops the lights will turn off. In my experience, for everything except taking a bath, 2 or 3 minutes covers just about everything. So one option is just to put in 5 minutes and see what happens. I actually put motion sensors in showers, so that the bathroom lights won’t turn off when someone is in the shower. I haven’t put a motion sensor near the large tub in the master bathroom, and I’ve had the experience of the lights turning off while in the tub, and then waving my arms to get them back on. I believe this can be solved just with the amount of time. 5 minutes is a long time for someone to remain still.

I have a covered patio with a ceiling fan. I use a motion sensor to turn that fan off after 5 minutes of no motion. The fan has never turned off when someone was sitting in the motion sensor coverage area.

At this point, every bathroom has motion controlled lights, both on and off. The only time I’ve had problems with it, is when ST was having cloud problems.

(Barry) #10

Using a motion sensor is great for turning ON the lights upon entry to a bathroom, but they’re not so good for turning the lights off at the appropriate time.

Perhaps the answer is to augment the setup with a door open/close sensor. In my house people tend to close the bathroom door when they want privacy (toilet, bath, shower). So, we just need to prohibit the motion sensor from turning off the light if the door is closed, and then have the lights go off a minute or two after motion goes inactive when the door is open…

All that said, I don’t think there is a standard app that can handle this. This might do the trick:

 *  Occupancy Manager
 *  Copyright 2015 Barry A. Burke
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
    name: "Occupancy Manager",
    namespace: "SANdood",
    author: "Barry A. Burke",
    description: "Occupancy monitor & switch controller",
    category: "Green Living",
    iconUrl: "",
    iconX2Url: "",
    iconX3Url: "")

preferences {
	section("Title") {
		// TODO: put inputs here
    	section("Occupancy sensors..."){
			input "motionSensor", "capability.motionSensor", title: "Monitor this motion sensor", required: true
        	input "doorSensor", "capability.contactSensor", title: "Monitor this door contact", required: true
            input "theSwitch", "capability.switch", title: "Operate this switch", required: true
        	input "minutes", "number", title: "Turn off after (minutes)?"

def installed() {
	log.debug "Installed with settings: ${settings}"


def updated() {
	log.debug "Updated with settings: ${settings}"


def initialize() {
    state.occupied = false
    if (motionSensor.currentMotion == "active") {
    subscribe(motionSensor, "motion", motionHandler)
    subscribe(doorSensor, "contact", doorHandler)

def motionHandler(evt) {
   	if (state.occupied && (evt.value == "inactive")) {
    	if (doorSensor.currentContact == "open") {						// motion sensor can't turn off lights if door is closad
        	Integer lightsOffDelay = settings.minutes *60
        	runIn(lightsOffDelay, lightsOff, [overwrite: false])		// Don't overwrite doorOpened lightsOut() schedule
    else if (!state.occupied && (evt.value == "active")) {				// somebody just came into the room
    	unschedule( lightsOff )				

def doorHandler(evt) {
    if (evt.value == "closed") {
    	unschedule( lightsOff )											// just in case
def lightsOn() {
	if (doorSensor.currentContact == "open") {							// Only turn lights on if door is open (they might be sleeping)
        (theSwitch.currentSwitch != "on") {
        state.occupied = true

def lightsOff() {														// We can only turn off the lights when the door is Open
    if (doorSensor.currentContact == "open") {
    	if (theSwitch.currentSwitch != "off") {
    	state.occupied = false

Suggestions Needed - Bathroom Motion