Away-At-Night Light Randomizer v0.1



Away-At-Night Light Randomizer v0.1:

Operating on a 30 minute interval, randomizes turning on/off selected lights (ghostLights) while you are away at night then turns off or restores the previous state of the lights when you arrive home or after the time set as the end time. Sends a PUSH notification at the start and end of randomizing. Because it uses a random toggle, the state of each device may or may not change during any given 30 minute interval. Uses custom LocationMode: Away Night but can be set to another mode such as the standard Away mode or even be changed to a time check. Great as a vacation light scheduler. Loosely based on the original code When on vacation - randomly toggle lights/switches by @baivab

User definable variables:
ghostLights: Enter all of the lights you want to randomize.
endTime: Enter the time at which the randomizer ends if you still haven’t arrived home. Can be set to Preset: Sunrise to operate all night.
enableOffOnly: set this to true if you want the lights to be turned off (rather than restored) on mode change or at endTime.

This piston illustrates the use of the Capture attributes to local store and Restore attributes from local store.


Thank you! I’ve implemented it, with some changes (reduced the 30 down to something smaller).


Feel free to post your variation if you think others might find it useful.

I’m not totally happy with my posted version. Especially I’d like to modify the exit from the randomizing to be more immediate. I’m experimenting when I have time and will post if I come up with anything that works like I want it to. If anybody has that already sorted out and modified, I’d love to see it. I welcome suggestions on how to accomplish a fast exit too.

Please do build on top of what I put together (also using the work of others) and post your improvements. All modifications are welcome.


I’m not really building on, just modifying. No bandwidth to get too deep into Webcore these days.

But, I need some help with this. I’m having an issue where it’s triggering when I’m home, but my wife is away.

What triggers the “away mode” in Smartthings? I have life360 doing presence for alarm setting, etc, and IT thinks I’m home now. So, why does Smartthings think I am not? My “Goodbye” routine in ST is what I have triggering Away, when “Everyone Leaves” and both of our Life360’s are in that “everyone” group.


I’m using custom Location Modes and I set them using a piston that monitors presence changes to our smartphone presence ‘sensors’. But Location Mode can also be set in Routines and possibly other places too. Smartthings uses Location Mode but also SHM (Smart Home Monitoring). It sounds like maybe SHM is how your alarm etc work.


Here’s a variation using the Smart Home Monitoring status instead of the custom Location Modes.


That’s a much better way to trigger it. We were “away” the other night on a date, and the babysitter was quite alarmed by the lights changing randomly…

Thanks. I’ve implemented and will give it a test tonight.