How to play a sound at randomized time intervals

I have a large wooden barn which is much appreciated by the woodpeckers around here, making quite large holes. Until now, nothing worked to repell these birds: different kinds of paint, reflective material, fake birds of prey. One thing I didn’t try yet, is playing the woodpecker alarm call. This seems to scare them off, especially if played in early spring, when territories are set.

So, now I have a track of the alarm call and 2 old sonos speakers in my barn, that are connected with my homey. The alarm call is most effective if it is played between sunrise and sunset, at randomized time intervals, say between 1 minute and 1 hour.

I guess I have to make an advanced flow that states that if it is between sunrise and sunset the alarm call must be played on the 2 sonos speakers in randomized intervals.

How should I go at this? What does the flow look like? What must I script (like the time interval) and are there scripts readily available?

Something like this?

You could also use FlowBits to set a timer, that would improve stability. Since the flow isn’t in a waiting state, but will be triggered when timer is done, like this:

1 Like

My app FlowBits has a randomized timer card. Your flow could look like this.

1 Like

Lol i was just editing my own post with that suggestion :stuck_out_tongue:

1 Like

1 Like

Thanks for the Flowbits tip!

Thanks for your reaction.

Where do I find the “it’s before sunset” card? It’s not in my Date & Time collection. I only have an “it’s after sunset” card as an AND possibility.

Btw, the “the sun rises” card always needs a number of minutes in my Date & Time collection. Are you using a different collection or do you have an expansion?

Right-click the card and select reverse (omkeren)

Ah yes, of course :person_facepalming:

Thank you!