Random Actions

Hi guys. Is there a way to randomise lights. Basically when Holiday mode is activated, I want certain lights to turn on and off randomly after sunset. Is there a random feature which I can't see?

Not quite an answer to your question. But something I realized in our household. We are pretty much creatures of habit. We tend to get up, do certain things, etc. pretty much the same time every day. So I just have our lights follow the normal schedule when we're gone.

2 Likes

Hi thanks, many of my lights are motion operated so have a random appearance from the outside world. I guess I'm trying to replicate the randomness when we're away from home

You can use a random, delay (the delay will be somewhere between 0 and your chosen value when thus option is chosen). So if you have a rule that triggers at sunset (or some time before), you could use a random delay before tuening on the lights, then maybe another delay (to get some minimum time) plus a random delay before turning them off, assuming that something like this is your goal.

1 Like

Hi, thanks for this, it makes complete sense, however where does the random delay live?

Interesting, looks like something changed in Rule 5.0 in that regard. (EDIT: Nevermind, it's still there--see below!) This is how it worked previously. Now I suppose you'll need to use variable delay and set the variable to a random value, both of which are possible. I believe something like this would get you a random value between 0 and 30:

Wow, and thanks for your help. This seems fairly over engineered but do we have a choice?

So if I had 5 different lamps (1 per room) I would require 5 On variables and 5 Off variables. Is this correct? Plus repeats to make it look like people were home (lights on and off multiple times in an evening.)

I just checked out RM Legacy (below image), and I couldnt see the random delay there either. I'm sure I've seen it somewhere as a simple option. Surely there is an easier way to do this.

Am I the only person who wants lights to turn on and off randomly when away?

Am I missing a simple trick here guys :rofl:

That does have it. But you'll need to use the standalone "Delay Actions" action, rather than a delay on an action. (If you use delays in an action, also note that they work differently: a standalone delay pauses there, then resumes with the next action after the specified time; a delay on an action schedules that specific action for that time in the future, then moves on to the next.)

Even in 5.0, you wouldn't necessarily need 5 variables; you could reuse the same one and just keep setting it to different values. But with that many lights, either way seems a bit messy. I know there are community apps designed to help achieve this same goal, but I'm not familiar with any personally (you might try searching for them). Might be easier if you don't mind custom code.

This option still appears in Rule Machine 5.0 as well… :sunglasses:

2 Likes

Weird, just tested that after I wrote the post and the OP couldn't find it, and I didn't either. Thanks for the find! :smiley: (My guess: maybe I didn't actually fill in a value for the delay; lots of the UI is dynamic and responds to what you put in.)

1 Like

Yes, the Random feature did not appear until I put in the delay time, and then clicked off that field.

FWIW, you can set a random value into a Number variable.

Cheers guys, I've now found this in RM5 as shown by @ogiewon. However, to get the random toggle to appear, we are required to populate a time which is displayed in @ogiewon image. I'm confused with how a time i.e. 10 mins can be random.

Cheers @bravenel from over the pond. Can you give me an example of this just for clarity please. Appreciated in advance

I believe RM will generate a random delay between 0 and 10 minutes. @bravenel would know for certain.

The time entered is the upper limit on the random value. Same with setting a Number variable. To do that you use Set Variable, then Variable Math, then select Random. The random number will be between 0 and the number entered.

1 Like

Thanks Bruce, the penny has dropped for me now, all makes sense and much appreciated! Without sounding rude, is there a reason that the "random" feature isn't available on a delayed action but is available as a stand alone action? Thanks in advance to all included @bertabcd1234 @ogiewon

2 Likes

Oh, I forgot to say, thanks Bert for the community apps pointer :+1:

It's very much an edge case, and didn't want to 'mess up' the UI/app everywhere in support of it.

Understable Bruce, thought I'd ask the question. Thanks for the rapid response and keep up the great work. Guys like us really appreciate the 1-2-1 support offered from the likes of yourselves :+1: