I know this has been discussed in the past, but it’s been quite a while and the solutions from those old posts weren’t doing quite what I needed. But, kudos to Jeremy (user thejeremyg) for your post on this topic back in 2023 that boot-strapped me! My solution does not require “premium” SharpTools. (UPDATE 5/24/26: Apparently, it does. I can no longer edit withot being prompted to buy premium. Don’t know what changed… oh well)
So, I built three simple triggers in SharpTools in front of SmartThings that turn 4 lights on and off randomly one at a time between the hours of 10pm and 5am (configurable) when I set a “Vacation Lighting” variable in SmartThings to ON. Each light has its own random interval for how long it’s on, and the time until the next comes on is randomly settable as well. Currently just one light at a time, but more than one on at once wouldn’t be too hard to do.
Trigger 1 just gets the loop going by flipping a variable when Vacation Lighting gets turned on.
Trigger 2 pauses a random time (the lights off interval) then picks the next light to turn on (or not if we’re not in the specified time window).
Trigger 3 actually turns the picked light on, waits that light’s random interval, then turns it off.
#CurrentLight is the number of the light to turn on, set by rule “Pick a random light”. It being zero is also the trigger for that rule to start executing.
#RandomLight being 1 is the trigger to run the “Turn on the chosen light” rule.
You also have to define a variable named “Vacation Lighting” in the SmartThings “Labs” section that is the switch to get the whole thing going. Turn this ON when you go away.
The first rule simply triggers when this variable is ON then sets CurrentLight to 0 which activates the light selection process.
The second rule triggers when CurrentLight is 0, then if Vacation Lighting is ON, delays a random amt of time (all lights off), then if we’re in the chosen time window, sets CurrentLight randomly to 1,2,3 or 4 and sets RandomLight to 1 so the third rule will trigger. Not in the time window, it sets RandomLight and CurrentLight both to 0. If Vacation Lighting is OFF then it turns all 4 lights off and sets CurrentLight to 5; a neutral vale that won’t trigger anything. (Not quite sure why, but the pics posted backwards. Read from bottom to top).
The third rule triggers when RandomLight is 1, then turns the selected light on, delays a random amt’ of time then turns it off. It does this in nested IFs: If CurrentLight is 1…, ELSE IF CurrentLight is 2…, ELSE IF CurrentLight is 3…, etc. Only the first two are shown in the pics. At the end, it sets both RandomLight and CurrentLight to 0. The latter triggers the selection rule to fire again.