SmartThings Community

Turn off light after specific time


#1

Sorry for such a basic question, but I’m new to SmartThings.

I have a motion sensor and Phillips Hue bulbs. I would like to have the motion sensor trigger a bulb to turn on, and then have the bulb turn off after x number of minutes.

Is it possible to have the bulb turn off if no motion is detected in x minutes?

Thanks


(Ingram Leedy) #2

Seems this feature isnt a feature any more. This was available in v1, but not in v2 it is gone.


(Bruce) #3

Look at this thread: Light Timer


#4

Thanks. Is there a guide as to how I’m supposed to use these apps?


(Bruce) #5

Yes there are, here in these forums.

Look here: FAQ: An Overview of Using Custom Code in SmartThings


(Bruce) #6

Short answer is this:

Login to the IDE at https://graph.api.smartthings.com

Go to My SmartApps, then New SmartApp, then From Code tab.

Copy the code from the link above, and Paste it into the IDE. Then hit Create.

Then Publish / For Me.

At that point, you can install the app using your mobile device by going to Marketplace / My Apps, and then scroll to find that app.


#7

Excellent - thanks for the information!


#8

One more question - it looks like both apps (code) in the referenced link are for turn off after some minutes.

Where can I find the code for turn off after motion stops?

Thanks


(Bruce) #9

(Pizzinini) #10

You can also use the “Smart Lights” app for this. it is the new SmartThings app that combines much of the functionality of many previous light/switch automation apps. You can find it under “SmartThings Recommends”.


#11

It’s not quite the same functionality. That’s what people are saying that the functionality is missing, and what @bravenel has provided to replace that.

The new smart lights does have the ability to set a rule to turn off after a period of inactivity on a motion sensor, but the options are only available to you if you also included in the same rule that you were going to turn on the light from that same motion sensor.

However, many people have use cases where they turn a light on for some other reason, perhaps just with a wall switch or a virtual switch controlled by Amazon echo, but then they want it to turn off after a period of inactivity. That’s what this community code provides. :sunglasses:


(Bruce) #12

Actually, Smart Lights does not do this, and that is why this has been posted. Smart Lights does this if you use the Smart Lights automation to turn the lights on with motion, and then off later.

But Smart Lights has a bug that won’t allow you to specify the number of minutes if you only use motion to turn a light off.

To fix that bug, short term, this app does that.


(G) #13

Thanks for the App Bruce, exactly what I needed.
One more question, I have light that turns on if door is unlocked, and I like to turn it off let’s say after 5 minutes BUT only if it was triggered by the unlock not in any other case.
Is this possible?

Thanks