Hi everyone. I am new to SmartThings and the forum.
Here is my scenario:
I have a motion sensor in the bathroom. This is what I would like to do: when there is motion, if lights in that room are off, turn them on, otherwise, if lights in that room are on, turn them off. The smart app called “my light toggle” by Jesse Silverberg is the closest thing I have found. However, it requires a master switch and the only switches in my setup are hue lights. So, I need to have a light on all the time in order for this to work. Any ideas/help?
If the lights are OFF and there is motion, turn the lights ON.
If the lights are ON and there is motion, turn the lights OFF.
I don’t think Smart Lighting can do that. Without some custom code, you’re going to find yourself in a race condition where the lights blink on and off, I believe.
It absolutely could be done with a custom Smart App, however. You’d have to build in some delay.
@NorCalLights yes. That is what I want to do. I figured that it would require some custom code. Do you have any suggestion on how to implement the delay? Is there some sample code that I can use to help me figure it out? I have to go through some documentation too to figure out what this entails.
FYI I think @JDRoberts uses motion sensors in boxes as “touchless” switches. He’s posted about it a few times. Maybe give a search and see if there’s overlap between what you’re doing and what he does.
Thanks for all the replies. Here some more details about what I am trying to do. I use the smart things motion sensor. And yes, the touchless switches sounds like what I am trying to achieve. So, let’s say the initial state is lights off in the room. When there is motion by entering the room, the lights should turn on (toggle the state). Then I exit the room from the same door, after let’s say a couple of minutes, triggering motion on the same sensor and thus turn off the lights (toggle the state). The smart lights app does let me turn off the light but It does not have a condition to check if the lights are on or off. If I do create two tasks then I would think there would both trigger at the same time for the same sensor/motion, trying to turn on and off the lights.
Couldn’t you just use the basic Smart Lighting logic of: if there’s motion, turn the lights on. If there isn’t motion for 10 minutes, turn the lights off.
Based on your example, it seems like this would work.
This would work. But if I wanted to stay in the room longer than 10 minutes, then the lights would turn off while I’m there. I just wanted them to turn off dynamically - that is, when I exit the room, whether that is in 2 minutes, 5 minutes, or 15 minutes.
As long as your motion sensor is positioned so it can “see” most of the bathroom, you should be fine. The timer will reset every time it detects any motion.
In the meantime, I’ll think about how to modify that code to do exactly what you’re asking.
Actually, I think “my light toggle” does what you asked for. The app was designed to allow for multiple lights to toggle together according to the status of one particular light. So if some are on and some are off, the toggle only cares about the master’s state and flips only the necessary lights. Try the app with one of your hues as the master switch and all 4 hues in the toggle field. Then, when a motion event gets detected, the smart app looks at the master hue to decide if they all should turn on or off.
@GuyInATie hi Jesse! Thanks for joining the conversation. actually last night I gave your app another shot. I created a virtual simulated switch that I have on and added the lights I wanted switched on and off and it works! However I know noticed that the motion sensor, once it becomes activated, it stays active for 15 seconds or so until it sends no motion. I am not sure if this is related to having to re-pair the sensor with the hub. When I connected it the fist time, the motion status was pretty instant. Now, after having reset the sensor (did so b/c it’s stopped responding), the hub shows motion for at least 15 seconds with no motion. Is there something I can do to address that? A setting/calibration or should I try removing and adding the sensor again?[quote=“GuyInATie, post:13, topic:47375, full:true”]
Actually, I think “my light toggle” does what you asked for. The app was designed to allow for multiple lights to toggle together according to the status of one particular light. So if some are on and some are off, the toggle only cares about the master’s state and flips only the necessary lights. Try the app with one of your hues as the master switch and all 4 hues in the toggle field. Then, when a motion event gets detected, the smart app looks at the master hue to decide if they all should turn on or off.
[/quote]
@nalexiou Happy to – it’s my pleasure to offer any help you need with it!
The short answer about the sensor’s cooldown delay is that it depends on the make/model. I have 3 different types of motion sensors and I’ve found each one behaves slightly differently. As far as I know, the ST motion sensors are not adjustable in their cooldown time. My Ecolink pet-friendly motion sensors, on the other hand, are very adjustable. Inside the case there’s a jumper that allows for options ranging from 1 second to 4 minutes cooldown before updating their status with the hub.
I wasn’t clear from your last message – did the 15 second delay start occurring since you introduced the virtual switch & reset the connection, or did you just notice the 15 second delay after these steps? From experience, re-pairing devices hasn’t introduced any delays like the one you describe.
@GuyInATie it is actually kind of hard to tell what happened. I am not sure if the 15 second delay is related to the virtual switch and/or your app. Actually, I believe I tried adding a virtual switch as a GE switch. Then, I tried using that and the virtual switch went OFFLINE and the motion sensor stopped responding - which makes no sense to me. So, I decided to start off from scratch, reset everything and reconnect the sensor. I’ll try playing around with the sensor when I get home and see if I can get a better idea of the problem.
The first thing I would do is to watch the IDE and see what the delay is with the motion sensor cool down. If the delay in there is about 15 seconds (which actually sounds about right for most of the sensors I’ve looked at), then that identifies what’s happening. On the other hand, if the IDE is seeing much shorter cooldowns, then you have a bit more sleuthing to do!
[I know you said you’re new to ST, but this is exactly how the addiction starts! As you read more on the forums, you’ll see other people talking about how easy it is to get sucked into HA as a hobby!]
Thanks Jesse. Sorry for not responding sooner - did not have much time to play around with the setup. I now got the Ecolink sensor to try out since you mentioned it has a faster cool down (I moved the jumper to TEST). However, it registers motion for at least 6-10 seconds after motion has stopped. Do you have any ideas? How do I determine the exact time from the IDE?
To get a precise measurement for your particular setup, log into the IDE and go to the live logging section. You should see events happen in real time as the ST platform picks them up. Since everything is time stamped with hh:mm:ss, you should get a good read on how responsive the sensor is. If this is longer than 5ish seconds, then the next thing to try is to bring the motion sensor near your hub and try the live logging experiment again – this will verify that there’s no meaningful interference slowing you down. The next thing to try is a simple SmartLighting automation (STs staple lighting SmartApp) with the motion sensor and a lightbulb. While this won’t let you toggle the light, it’ll give you an independent measurement of the response time and help diagnose your setup.