Lights on and off randomly based on times


(Rick) #1

I’m looking for a smart app that will randomly turn on or off based on times programs.

Currently I have switch for my front porch light I bought from Home Depot. I have it programmed to come on at 7:30, and go off at 9:30. It randomly comes on and goes off 30 minutes before or after the programmed times. It never comes on or goes off at the exact time every night. I think this is a great security feature. I travel quite often, and this switch gives my house at more “someone is home” look to anyone who might be watching the house.

I’d also like to do this with a couple of inside lights. I did manage to piece together a couple of smart apps to build one that has certain lights or switches come on at certain times when I am “away”, and stay on for a set period of time. Unfortunately this is not random, it’s the exact time every night (only when I’m away), and stays on for a set amount of time I have programmed.

I’m not even sure this “random” feature would be possible, but would appreciate any feedback


(Bobby) #2

Look in the Marketplace for an app called Vacation Lighting Director, under Lights & Switches section. I didn’t try it personally, but it sounds like it does exactly what you need.


(Rick) #3

Close, but that’s more like the app I have now. You have to specify the amount of time the lights are on. The key thing I am going for is “random”, if that’s even possible.

Thanks though, I didn’t know that app was out there


(Doug) #4

I believe that it randomly changes between lights but at a set interval. I bet it wouldn’t be too hard to vary the interval a bit too.


(Jim Newman) #5

Have you found anything? I’m looking for the very same type of routine.


(Bob) #6

I have this set up for an upstairs Hall Light when I’m away.

IF
Here I have set up conditions that must be true.
In my case lux level, mode is away and between sunset and Sunrise.

THEN
Using upstairs Hall Light.
Turn on.
Wait 2 minutes.
Turn off.
Wait (random). In my case I have it set for 41 to 71 minutes.
Follow up with piston. Here i use this piston.

In this way the lights will turn on between sunset and Sunrise for 2 minutes every 41 to 71 minutes.

Works well for me.


(Rick) #7

This is somewhat closer to what I want, I just haven’t figured out the random thing yet. I’d love to see your code for this


(Bob) #8

I have used a ‘basic’ piston in CoRE.
Then set the conditions that the lights will turn on for in the IF.
Then set the light action and the THEN.


(Jim Newman) #9

After stumbling around and figuring out how to use CoRE, here’s what I came up with for a simpler case. Perhaps someone can tell me what if it’s really doing what I think it is. (My main question is the randomness.) Objective is to turn on the porch light at a random time within 15 minutes of sunset, and then turn it off at 11pm.

IF
Time is around sunset +/- 15 minutes
THEN
Using Front Porch
Turn on
Wait for custom time 11:00 PM
Turn off

And then, I want to do a more complex one - turn on living room lights around sunset, but no later than 8:00 pm, and turn them off around 10:30 pm. Here’s what I’m trying:

IF
Time is around sunset +/- 15 minutes
OR
Time is around 8:00 PM +/- 15 minutes
THEN
Using Living Room Outlets
Turn on
Wait for custom time 10:20 PM
Wait (random) 1-20 minutes
Turn off

Do these appear correct?

I’ve been browsing all through the SmartThings community forum, and done numerous Google searches – is there ANY place that provides a tutorial, or samples of setting up conditions (basic, simple, AND-IF, LATCHED, etc.), use of system values and built-in functions, passing information between pistons, etc.?