Away-At-Night Light Randomizer v0.1

lights
presence
timer
light
piston

#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.


#2

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


#3

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.


#4

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.


#5

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.


#6

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


#7

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.


#8

Hi,

Thanks for posting the code, I have been looking for a way to do this.

Have there been any changes due to newer versions of WebCore? I adjusted the program for my system but can not get it to work. I even added a bunch of checkpoints to send SMSs as a test, but as far as I can tell it starts then goes straight to the status messages.


#9

Greetings!

I set the away mode to my Home Night mode so it would run while I’m at home and it ran just fine for me. If you run full logging, you should see the random scheduling of the lights within 30 min but it can take up to 30 min. for the random scheduling to appear. I don’t see any Smart Home Monitoring in the new app so that variation may be deprecated by Samsung.


#10

I am thinking the up to 30-minute delay was the issue. I was able to get it to work.

Thanks for the response.