Vacation Lighting & SharpTools

Howdy,

Like many folks in here, I’ve been missing Vacation Lighting since the switch to Edge. I didn’t have time to figure out how to create a custom Edge driver/routine/app, so dug into SharpTools a bit more.

I have a solution that is a bit kludgy, but it seems to work and honestly, I think it provides more randomness (in a good way) than what I had with Vacation Lighting Director (albeit with more setup).

Pros

  • Control start/stop times based on your SmartThings modes
  • Randomize when lights turn on/off
  • Randomize which lights turn on/off
  • Randomize how many lights turn on/off

Cons

  • A little more complex setup than a SmartApp
  • Have to pay for SharpTools subscription (~$30/year) to support the custom variables

Anyhoo, wanted to share my SharpTools setup here for others…

Step 1

Create following variables:

  • $switchRandomLights - boolean (true/false), default value doesn’t matter, this will be used as a toggle to execute rules, toggle lights
  • $diningRoomLights - variable to control dining room light, boolean (true/false), default value doesn’t matter
  • $livingRoomLights - ie one variable per light you want to include
  • $kitchenOverheadLights - etc
  • $kitchenIslandLights - etc
  • $officeLights - etc
  • $masterBedroomLights - etc

Variables are the key for randomizing things in SharpTools. Below, we’ll use the pickRandom() function in an expression, but that only works in an “Action” flow and against variables. Maybe one day we can use expressions in an If/Else condition directly (feature request SharpTools!?), but until then we need the variable.

Step 2

Create rule to start vacation lighting when mode changes to Away (or whatever mode you want):

  • Trigger = Event Trigger, Mode, changes to “Away Evening”
  • Flow = Action, Set Variable, $switchRandomLights = True

Step 3

Create rule to control how often you change the lights.

Idea here is that this rule will:

  • trigger when the $switchRandomLights changes to true
  • set $switchRandomLights back to false (so can trigger again later)
  • pause for a random period of time (you set min/max window)
  • toggle $switchRandomLights on again

NOTE: I added a check that it only runs if Mode is still “Away Evening”, so it stops executing when I come home, mode changes, etc.

Step 4

Create a rule to determine which lights to turn on/off.

Idea here is this rule will:

  • trigger when $switchRandomLights toggles to True
  • one flow will use “random” function to set a light’s variable to true/false
  • second flow will then turn corresponding device (light) on/off based on value

Note:

  • each light will require two flows - one for the random function, one for the if/else to turn light on/off
  • could put all these in a single rule, or split them out into individual rules - personal preference
  • I put all in one long rule so I could view logs of lights turning on/off in once place

So far so good, fingers crossed. Took a bit to figure out and setup, but I like that (a) I can randomize how often lights change, and (b) I can randomize how many lights are on at any given time. We’ll see how reliably it works over time.

Let me know if you have a better way to do this!

7 Likes

Very cool! Thanks for sharing @thejeremyg !

3 Likes

So your randmize starts 61 minute’s after trigger and runs once over a 25 minute period?

Not exactly.

The whole process begins when my mode changes to Away Night.
At that point, it will turn on a random selection of lights.
Then it will wait somewhere between 61-86 minutes.
Then it will toggle lights again.
Then it will wait another random period between 61-86 minutes.
etc.

So:

  • SmartThings mode changes to “Away Night”
  • Rule “Start vacation lighting” changes $switchRandomLights to True

Then two rules fire at same time:

  • Rule “Toggle lights randomly” will turn on a random group of lights
  • Rule “Randomize vacation timing” will turn $switchRandomLights to False, wait a random period of time (between 61-86 minutes), then turns $switchRandomLights to True

This second rule is what creates the loop, triggering those same two rules to run again. Runs repeatedly until the Mode changes.

Thanks!

1 Like

Thanks, I missed the False to start the loop, So in theory I quess this should run indefinitely, when triggered

Yeah, it would run indefinitely. But that’s why I added the check after the delay to see if Mode is still “Away Night”.

If it is, then run again.
If it is NOT, then stop.

1 Like

I like it, I quess the possibilities are endless.

2 Likes

Yeah, I think so.

For example, if you have dimmers, SharpTools allows you to set the level via a variable (or so it appears to support). So you could create number variable to represent your dimmer value (eg 65%), use that in your actions. If you want to change the level, just update a single variable.

Confirmed, creating variables for dimmer values and using them in my actions works. Created different levels for different lights as well. Will gladly subscribe to pro version of SharpTools to solve this problem.

2 Likes

Great news, you inspired me to experiment with this, I went with a slightly different approach and created a realistic pathway of lights to the bathroom and back

1 Like

I’m really interested in this, and also a Sharptools user, but I have some routines with less complicated code. But if I understand this correctly, this will run continuously until you return? Wouldn’t it be more realistic looking for a home to have this turn on after you leave, but also only each day sometime around/after sunset, and then only run until a randomly chosen turning off time later at night? That could help the illusion the house is occupied, as it would be strange having random lights turning on and off all night long. Is this something that could be included easily? Also, perhaps this is conversation that needs to be put forward in the Sharptools community as well.

I quess the clue is in the trigger mode used

Exactly. I use the following modes:

  • Home Day
  • Home Evening
  • Home Night
  • Away Day
  • Away Evening
  • Away Night

SmartThings routines automatically sets those modes based on a combination of my presence and sunrise/sunset/time of day.

So then my vacation lighting can depend upon my Away Evening mode. If you don’t have similar modes, then yeah you’d need to come up with some other trigger to control start/stop times.

Enjoy!

Apologies didn’t respond to this sooner.

I use modes to split my day into Day, Evening, and Night, and then Home, Away - so I end up with 6 modesl total - Home Day, Home Evening, Home Night, Away Day, Away Evening, Away Night. I use routinues/smart apps in SmartThings to change the modes based on my location and time of day.

In my setup I include a check that this only runs while my mode is Away Evening. Around 11:30pm my mode changes to Away Night, thus stopping the lights turning off/on. Or if I come home around 9pm, my mode changes from Away Evening to Home Evening, also ending the random lights.

Hope this answers your question.

2 Likes