App to start at a random time/delay between two periods

I am looking for an App that allows me to choose a random delay between x and y minutes that can be canceled if required by another flow. Does one exist?

Steve

You can use the Chronograph app to initiate a stopwatch or timer via one flow and cancel that stopwatch/timer via another flow. There are flowcards that trigger when a timer/stopwatch completes or is stopped.

Thanks I did look at that app but I can’t see how to do the random function?

Ah yes, I missed that part in your question. I don’t think that app offers a randomizer. But you can use a variable as input for the timer/stopwatch. So if you first determine the random delay and put it in a variable, you can use that as input.

An App is not necessary, use 1 - 99 Sec. or Min. to have a random delay between the first and last value.

Also available in Standard Flows (since Firmware v 1.xx :wink: )


3 Likes

What, really? I did not know you you specify a range in that card
 Learned something new :blush:!

Thanks for this, I am very new to Homey and I am struggling to find an option for 1 - 99 I assume it is an AND trigger but I have looked at all the options and can’t see it. I also looked as a THEN under timeline but it did it give me an option for a delay.

It’s the Delay option (‘Wacht’ in Dutch) in the flow builder’s menu:

Thank you I looked at that but was looking for options, I didn’t realise I just needed to key in 1-5 say.

Steve

Yeah indeed. I also did not know that. It’s a little counter intuitive


Do realize when you start using minutes as unit, the chances of flows not running as expected increase.
These delays ‘disappear’ after a reboot, and related flow won’t continue.
I don’t use it for longer delays than a minute or so.

Is that for all delays or for 1-n delays?

yes that applies to all delays.

You can use a logic card and the app Chronograph. This timer will continue running after a restart.

Use the Logic card Calculate to generate a random nummer between 1-n:

and asign that number to a Chronograph timer:

With the IF card you can then start a flow:

3 Likes

Thanks this was very helpful.

Having input the random calculation though I can not get a number out of the equation, apologies I have only been using Homey for a short while.

I searched and found another example, which I incorporated for testing purposes and I managed to get that to work ok.

Do you type the calculation random or is it a tag?

Steve

I don’t quite know how but I managed to generate random numbers however it isn’t giving me the results I expected. I created a test routine to generate a random number between a range and then sent the result to my mobile. The routine is here:

The results are read from the bottom of this screenshot up showing the numbers generated. with the first number being signified by ‘Step 1’ and giving 45. In this case I thought I was going to generate a number between 1 and 15. Any views as to what I am doing wrong?

One observation, you overwrite the variable “Delay” every second


I send or process the message before I overwrite the delay variable, which I hoped would give it sufficient time to be used.

Or do I need to use a different variable each time but in that case why is the first attempt wrong?

Oh, when the flow is only for tests, 1s delay should be more than enough.

The issue I didn’t spot before:
you omitted the comma as part of the random function; It should be entered between the start- and end values:

Results of starting this card a few times:

1 Like

Thanks a lot really helpful.

1 Like