How to randomize a turn on time after trigger within defined window

Using HE C8, Would like to have some lights turn on from a trigger setpoint (say sunset) in a random fashion within a defined window of say +/- 10 minutes (user defined). Looked around and found Vacation Lighting Director, but it seems that you have to setup a window that the switch cycles on/off. I don't want to cycle the switch/light just once on after a triggered defined window and then off at a triggered time randomized by a user defined window. Tried using the rule machine but failed miserably. BTW - coding is not my forte by I can stumble around....

Use a Certain Time trigger in Rule Machine for the beginning of the time period that you want the random time within. Then, use a Delay on the action you want to happen at a random time, putting the total length of the time window as the time, and selecting Random, like this (for 20 minutes window):

If you wanted the random event to be between 10 minutes before and after sunset, the trigger would be for Sunset-10 minutes, the start of the 20 minute period during which you want the randomness to happen.

1 Like

Thanks, I'll give it a whirl and let you know.... Much appreciated!

@bravenel
It's been a couple of days now and the light keeps getting triggered exactly at sunset without any randomization. This is what I have it set as:


Ideas?

Please post screenshot of logs for this rule, with all logging enabled.

Here's an example, actions running twice. First time it fired the toggle 4 seconds later, second time 38 seconds later -- both against a 1 minute random window:

When you delay the action it doesn't delay the rule. And so your "on" my be random however your notification is always going to be the same at sunset.

Same with your yellow thing.

You could try adding a delay to the rule itself rather than the ON that might show you what actual time the on happens. I think your have to do this as you want the colour to come after the ON right?

1 Like

@bravenel
Thanks- will do tomorrow with screen shots of 'random' off and on... :v:t2:

What @BorrisTheCat said above is the explanation. Use Delay Actions instead of the Delay on the first action, if what you want is for all of those actions to be randomly delayed. The way it is now, only the first action is delayed, the others not at all.

2 Likes

@BorrisTheCat Don't understand how to put a delay to the rule - thx

then same as before

@bravenel
I removed the delays from the rule:

The light came on at sunset plus a couple of seconds. The log is below:

Not really what I was expecting. For the delay, don't I have to use whole minute values without seconds?

Remove the delay you have from your second action.

Add this as your first action:

@BorrisTheCat @bravenel
Modified my rule to the following:

Today the light came on with a delay of +2 minutes! Thanks for the help from the both of you....
Bonus = Learned something about Actions with this :grin:

2 Likes