Turn on light when ariving then turn off after minutes uless already on


(Nathan Gehlert) #1

Hello,
First post. I had been using Wink hub for a couple of months. It was a fun start, but felt like I couldn’t get past crawling. Switched last week to ST v2 hub. Wow, so much better!
Anyway, I have one thing that I can’t figure out. I currently have IFTTT rule via Life360 to turn on a side porch light when my wife or I are arriving home after sunset. The rule duplicates for a light inside the house. We like to have the lights on as we’re pulling into the driveway instead of turning on when the side door opens when we enter the house. I’d like to have these lights turn off after a set amount of time unless they were already turned on. The Smart Light Timer by listpope is so close to what I want, except it only triggers with motion or contact sensor. I appreciate any suggestions on how to get this setup.
Thanks!


(Bobby) #2

I assume you don’t have any sensors, right? If that’s the case then you can use modes. When both of you are not home, use the away mode. So when one (or both) of you comes home, run a routine that changes the mode to home and turns the lights on and then off after x minutes the lights you’d want off. Then when the other person arrives, the lights are already on, so you don’t need to take any actions. The rule to turn the lights on when someone arrives will be ignored because the home is already in Home mode. Does it make sense?


(Nathan Gehlert) #3

Bobby, thanks for the quick reply. I do have a sensor on the entry door, but we want this to run before we open the door because the light it outside. Here’s the thing that I think won’t work with modes… if my wife is home and I’m away, then the house is in home mode. When I arrive home, the outside porch light will be off and I’d like it to come on when I arrive home. That can’t be triggered because it’s already in home mode.


(Bobby) #4

I see…what really complicates things for you, is this scenario:

Why do you need them to stay on, if they are already on, and how would you turn them off?


(Nathan Gehlert) #5

Really do appreciate your help! If you look at the Smart Light Timer smartapp by listpope, it does exactly this… turn a light on and then off after a certain amount of time, unless it was already on (only trigger, however, is motion sensor or contact sensor). If my wife is sitting in the living room with the light on, I don’t want the light in there to turn off 10 minutes after I arrive home. But, if the light is off, I do want it to turn on and then off after 10 minutes when I arrive. Same for the side porch light. If she’s on the porch with the light on, I don’t want it to turn off 10 minutes after I arrive home. But if the light it off, then I do want it to turn of and then off after 10 minutes. One idea, which I don’t know how to execute… could I create a virtual motion sensor or contact sensor and somehow have that triggered by a virtual switch being turned on? I can have Life 360 and IFTTT trigger a virtual switch, so just a matter of linking that to a virtual motion sensor or contact sensor, which would trigger the Smart Light Timer smartapp, doing exactly what I want.


(Bobby) #6

Ok, it is definitely possible to create virtual sensors, but to make use of them you will need custom apps. An advantage of creating custom app is that you would eliminate the need to use IFTTT. One thing to consider, is the cloud vs local processing. A switch, a physical sensor and the Smart Light app will run even if the internet is down. Adding IFTTT into the mix, not only makes you dependable on a 3rd party server, but it will send your v2 operations into the cloud. The same goes for any custom apps, you forgo the local processing.

With that being said, even with a virtual sensor and a custom app you still need to find a way to update the sensor based on occupancy. What I found easier when I set up my lights, was to separate interior lights from the exterior lights.

The closest logic I can think of in your situation, is to set the porch lights to come on with presence. Then separately, set Smart Light app to turn the porch lights on and off after x minutes, based on your door sensor. These two actions will take care of your exterior lights.

For your interior lights, you really don’t need them to turn on with presence. You might want to turn them on with the same door sensor. Your problem is how to determine when they should go off.

Say your wife comes home first and opens the door, that starts the timer to turn the lights off in x minutes. I don’t really know how you’d prevent the lights from turning off in the living room, if you don’t have a motion sensor. If you are to use a virtual sensor, you run into the same exact problem as you would, with a regular switch. You have no trigger to signal occupancy.

Maybe @bravenel has a better idea, he is our master of custom apps…I personally, stay away (as much as I can) from highly customized apps because they require a lot of time to set up.

Hope this helps.


(Bruce) #7

Instead of a virtual sensor of any kind, it would be easier to just modify the smartapp to do exactly what you want. Using a virtual switch as you suggest could work just fine. You’d have to add a little code to that app: a section to pick the virtual switch, and a subscription to it that calls a handler (in initialize()) that would be almost identical to the motion handler or contact handler already there. That should work for you.

If I run out of stuff to do this morning, I’ll hack the code for you… Pretty straight forward.


(Nathan Gehlert) #8

@bravenel, thanks so much for that offer. I really appreciate it. I am familiar with the working of the Smartthings IDE (got my nest integrated), but creating smartapps is a little over my head - all that to say, thank you.


(Bruce) #10

Having looked more at this app, I don’t think it’s likely to work very well. It’s somewhat convoluted. Perhaps I’ll scratch out a replacement.


(Bruce) #11

Here is an app that does what you want: It turns on the lights when a Momentary Button Tile is turned on (which you would use Life 360 or IFTTT to do), and then turns them off x minutes later, unless they were already on.


Turn Light Off After X Amount Of Time Unless Triggered
(Nathan Gehlert) #12

@bravenel, thanks so much for your work on this. I’m heading out of town tonight for a work trip and don’t return until Sunday. So, I won’t get to play around with this until next week. It does look like that one is what I want - I’m excited to try it an report back!


#13

This is really cool. Is it possible to use Presence as a trigger for this instead of the Momentary Button Tile? Scenario is simply when someone arrives have a light turn on, then turn off after x minutes, unless they were already on.


(Scott G) #14

The beauty of the Momentary Button Tile is that it can easily be used in other automations because almost all of them have an option to “Turn on a switch”. Just set up a Routine that triggers using presence and turns on the Momentary Button Tile.


#15

I hadn’t used the Virtual Switch or Momentary Button before. Just did some quick research and it’s opened up a whole new world for me. Thanks!


(Bruce) #16

You should check out Rule Machine and Trigger Happy!


(James Dillon) #17

Hi,
This is my first attempt at using smartthings and as such have 0 experience.
I have a Smartthings hub with some Lightify Garden lights that I am hoping to use as driveway lights. I am hoping to be able to use a smart app to turn on the light with the presence mode (I have them able to turn them on), but am unable to turn them off after a set number of minutes (like 10). I also do not not understand how to add a smartapp to my hub and get it to work.
It looks like this covers what I want to do (using driveway lights vs. a porch light), but still do not see where to search for the smart nor how to apply (edit the # of minutes).
Any help would be very much appreciated.

Thanks,
Jim


(Ron Talley) #18

Use CoRE.

Simple Piston

If presence (phone) becomes present
Then turn on—wait 10 minutes—turn off
Else leave on


(Brian G Skinner) #19

@bravenel - This is exactly what I’ve been looking for, and it’s working perfectly! Thank you so much for your work on this. This thread also introduced me to virtual switches, specifically the Momentary Button Tile - very cool.

Thanks again!