I need to stop lights turning on while baby is sleeping


(Daniel) #1

I have the lights in my nursery set to turn on when motion is detected which is awesome!! But now that the baby is starting to nap in her crib and i want to be able to quickly disable the motion sensing for the over head lights in just her room.

I have tried to create a new mode “baby sleeping” that disables the motion sensing in that room and it seems to work fine, but the problem is that the only way i can find to change the mode is from my smart tiles interface. I need it to be as easy as possible for my wifes sake.

I would love to have it setup so that if i double click the smart light switch in her room it will automatically change the homes mode to baby sleeping. It would also be nice to double tap it in the on position to get everything back to my normal home mode.

Any advice would be great, im not good at writing smart apps yet… :frowning:


Turn light off after no motion, but not if it was manually turned on
#2

In order for double tap to work, you have to have a smart switch that will transmit the double tap. What model switch are you using? If you already have a switch installed that will transmit a double tap, then the existing double tap SmartApp might be a place to start. #6 under convenience in the following topic.

Yet another option is a mode control toggle. You can use this as a wall switch or just on the table. I really like it.


(Daniel) #3

Here is the switch i have.
GE In-Wall Toggle Switch (On/Off) $47.00

I got it right out of the smartthings store. will it work with what i am trying to do?


#4

Just to be clear, paddle or toggle? Dimmer or not?


(Daniel) #5

no dimmer, toggle switch

edit: Thanks so much for being a great ST community member JD. You have seemed to answer most of my questions on my previous posts and it seems like a lot of other peoples too


#6

Check this out. It might work. But some Community members report the timing never gets quite right. But since it’s not a dimmer, there’s a chance it will work.

Personally, I’d consider the mode toggle switch as a separate option from the light switch. You can put it anywhere in the house, including outside the baby’s room, and you’d have a little more flexibility. But different things work for different people.

And thanks for the kind words. I really don’t answer that many questions, but I’m particularly interested in two things: network protocols, and how specific devices process specific network protocols. So it’s just automatic for me to pay very close attention to the differences between different models, and to go ahead and read things like conformance statements that make most people’s eyes glaze over. And I have the advantage of using voice technology, which makes it very easy to respond in full paragraphs. :wink:

You won’t find me on many of the threads about, for example, Sonos, irrigation systems, thermostats, or cameras, unless there’s a basic protocol aspect, and then it will just be one or two comments on that aspect. And I don’t join in any of the topics about specific app code, because following a block of groovy code with a text reader is almost impossible.

It just happens that I find the “will this device do that?” Conversations very interesting. :blush:


(Daniel) #7

ill give it a try but i think that i tried this and it is only able to change the hello home actions and not the modes.

controlling the mode is what i found worked for me, although i could be missing something. Right now i have a smart app setup so that if the nursery motion sensor sees movement it turns on the overhead light. To get it to not turn on the light when the baby was sleeping i added a mode “baby sleeping” and then i went and modified the smart app to only perform the action “motion = lights” to work only when the mode is not in “baby sleeping”

is there a better way that i am not thinking about to accomplish what i need?


#8

That sounds like a good approach. A hello home action can change the mode, so if you’re triggering a hello home action, you should be able to have that hello home action put it into the mode “baby sleeping”. You shouldn’t need to write your own smart app to do that, although you can, of course.

The following might also be relevant:


(Daniel) #9

ive got it all set up, i will give it a try as soon as i get home from work. Thanks again JD


#10

Good luck! Letting sleeping babies lie is always a good thing. :blush:


(Bruce) #11

If that doesn’t work, I have another way to do this that I’ve used, for the exact same reason. I wrote a very small app, that I’d be happy to share with you if you need it. The way it works is this: If you turn off the switch manually for the light that is ordinarily turned on with motion, it disables the motion turning it on. It remains disabled for motion until you allow the light to be turned off by motion inactive. No modes are involved, so nothing else in your setup is affected by it. I did this for my visiting granddaughters. I may have to resurrect it soon, as they are coming for another visit soon.


Smart lighting tweak - honor me turning the switch on
(Bruce) #12

Below is the code for the app. For this to work you will need to make a few changes to your setup.

  1. In the IDE create a new device (in My Devices), and give it the type On/Off Button Tile. This is a virtual switch. You have to give it a name, an address, and assign it to your hub.
  2. In your shortcut where motion turns your light on and off, replace the light being turned on/off with your new virtual switch.
  3. Install this app, and specify the real switch and the virtual switch.

What will happen is that when motion goes to turn on the light, the little app will check first to see if it should turn it on or not. If motion is enabled, it will turn on just as before. If motion is disabled, nothing happens.

You disable motion by turning off the real switch while the light is on. To re-enable motion, all you have to do is walk away, and let the motion turn-off do its thing.

preferences {
	section("When this real switch is turned off...") {
		input "realSwitch", "capability.switch", title: "which switch?", required: true
	}
        section("This virtual switch helper will disable motion...") {
    	        input "virtual", "capability.switch", title: "which virtual switch?", required: true
    }
}

def installed() {
	initialize()
}

def updated() {
	unsubscribe()
	initialize()
}

def initialize() {
    subscribe(virtual, "switch.on", virtualOnHandler)
    subscribe(virtual, "switch.off", virtualOffHandler)
    state.motionEnabled = true
}

def virtualOffHandler(evt) {
    state.motionEnabled = realSwitch.currentSwitch == "on"
    if(state.motionEnabled) realSwitch.off()
}

def virtualOnHandler(evt) {
    if(state.motionEnabled) realSwitch.on()
}

(Daniel) #13

Wow Bruce thats awesome! I will work on getting everything set up while I am at work today, and then test tonight. I’ve been thinking i need to learn more about virtual switches, and this seals the deal lol


(Daniel) #14

everytime i try to create the virtual switch i am met with this error code

Error 500: Internal Server Error
URI /device/save
Reference Id e94b7568-247d-457b-97a3-42ceeb083ff6
Date Mon Apr 20 12:48:44 UTC 2015
Class java.lang.IllegalArgumentException
Message identifier required


(Bruce) #15

I don’t know what that error is. Does that happen when you hit Create in the My Devices section of the IDE?


(Daniel) #16

Yes it does.

and it also makes me log back in all of the time…


(Bruce) #17

I sent you a Private Message. Check that.


(DavidK) #18

Hello, trying to understand the smart app code above.

Question, you wrote:

To re-enable motion, all you have to do is walk away, and let the motion turn-off do its thing.

Do you mean, physically turn the switch on and then walk away?

If not, how does it know to start motion again?

Thanks in advance!


(Bruce) #19

Yes, that’s what I meant. Allowing the motion-off to turn off the light re-enables motion.


(Russell Dicker) #20

Do you have a suggestion for a good switch that can be hard-wired and will transmit a double-tap? Ideally can also differentiate between double-up an double-down. The more it looks like a plain switch the better.