Random Number / Random Time in Rule Engine

Hello! I there a “random number” that i can use on the rule engine to program some sort of “away lights”?

I want some chosen lights to turn on and off at random times when im not home. If the random number is from 0 to 9 it is ok with me, becase i can add a 15 plus that random number and i have a perfect time.

Thanks!

Hi @An_Dres, random time trigger is not currently supported, but sounds like a great idea to be added to my list. Other than random time trigger, do you need something like “random” duration to turn the lights off? This sounds to be a great feature but I need to think about the design how users can create “away light” automation easily but with some flexibility. But thanks for the great suggestion.

2 Likes

Thanks for your quick response James! Yes, i need the random trigger only for my away lights…

My away lights would be:

Turn light 1, light 2 and light 3.
2 at a time
For a random number between 10 and 25 minutes.

1 Like

I would also be interested in being able to turn lights on/off randomly. I envision this as being a random offset of sunset/sunrise. This is what I am currently doing with WebCore as a vacation/away crime deterrent.

@Steve_Jackson, thanks for the inputs on random offset of sunset/sunrise. I will need to include that in the design. :wink:

1 Like

I would also find this very useful. I was able to create the rule in sharptools but am missing the random turn offs… I am more than happy to share my rules and webore pistons if it would help.

1 Like

@Terri, it’d be great if you can share your setup and describe the use cases to help give more context about this feature request.

I currently use webcore to randomize my lights cycling on/off at random ti.es between 5-29 minutes when I’m away at night. I like using randomized times vs set intervals because it is more reflective of someone being home. Also, if you are away for an extended period, it is easy to catch on to set intervals and know Noone is home.
Here is my current webcore piston. Is it quite complex and uses variables. I am aware it could be simplified! Actually I did simplify it nicely in the rule engine EXCEPT the lack of randomized times which is why I’m still using webcore (until ST ends groovy).


1 Like

Hi friends, I think that could be a great feature, because the only SmartApp I had found is Vacation Light Director but is not total “random”, only for picking up which lights turns on, but after that the only function is turn them on/off to a predefined time in a cycle. I think a great function could be about:

  1. Set a time frame (specific or from sunset to sunrise, b.e. from 20:00 to 01:00)
  2. Set a time cycle (every X minutes, b.e 60 minutes)
  3. For each cycle, pickup a random light(s) from a group of devices to turn it/them on (b.e 2 random lights from a group of 10)
  4. For each device pickup random time between a min-max to keep each light on (b.e. random time between 10-30 minutes)

So random feature could be:

  • To pick a random device from a group of devices.
  • To set a random time delay between a time frame after random devices were switched on.

The rest of cycle could be programmed as usual in an IF bucle.

Hi friends, I had found this old post and I would like to update. For users in Smartthings, there is an Smart App named Random Lights on-off. That creates a switch, also you can set for which devices and timing that randomly ON-OFF. Its enough for a vacation, I had used it by a year and it works sharply, I will cancel my vote on this feature because the need its solved. I hope this can help everybody.

I too am in the same predicament with the impending withdrawal of webcore support and also have been.using a randomised lighting piston for a number of years now. I’m looking at Sharp Tools as a replacement for Webcore but I’ve hit my first stumbling block with the lack of a randomiser - hence another vote from me.

Thanks for posting, Ian. Can you share more details about where you would use the random number within your randomized lighting rule? Would you want to use it in the Wait/Delay command or somewhere else?

Using the /math endpoint on our Lab Server, you can pass in a formula of randomInt(max) to get a random number back. I suspect the next key part of this is extending the Delay action to accept a variable. :wink:

Thanks for the quick response. The way this works for me in webcore is that a random number of lights (between user defined min/max values) turn on randomly for a random period of time (again between a min/max value).

I hope this helps and thanks again for your interest in my feature request.

I also need this feature, both for triggers and delays.

I also have this need and my use case is exactly like Ian_Burgess. It would be great is this was available before webCore goes away in SmartThings.

Make sure to scroll up and cast a vote at the top of the post! :slight_smile:

I would also note that this particular request is for being able to use random numbers on the time side of things (eg. using a random number in a delay).

Ian also mentioned a random number of lights (random selection of lights?) which is not covered by the original feature request and I’m not sure if I’ve seen a separate feature request submitted for that before. Feel free to create a request if one doesn’t already exist.