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.