# How to play a sound at randomized time intervals

**URL:** https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903
**Category:** Questions & Help
**Tags:** homeyscript, sonos, homey-pro, advancedflow
**Created:** [February 10, 2026, 11:35am UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903 "2026-02-10T11:35:50Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Tiengemeten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiengemeten/32/78864_2.png) [@Tiengemeten](https://community.homey.app/u/Tiengemeten)
#### Post date: [February 10, 2026, 11:35am UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/1 "2026-02-10T11:35:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Anoniemand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anoniemand/32/120697_2.png) [@Anoniemand](https://community.homey.app/u/Anoniemand)
#### Post date: [February 10, 2026, 11:53am UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/2 "2026-02-10T11:53:42Z")

</div>

Something like this?

 ![Screenshot 2026-02-10 at 12.52.00](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/a/eaea9d4eff9ce53d674910e67e00b06a7425781c.png)

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:

 ![Screenshot 2026-02-10 at 13.00.18](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/9/f9dd2034ea9030837d9da40cef5da379d3078a76.png)

---

<div class="post-metadata">

### Author: ![BasMilius](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/basmilius/32/146560_2.png) [@BasMilius](https://community.homey.app/u/BasMilius)
#### Post date: [February 10, 2026, 12:00pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/3 "2026-02-10T12:00:27Z")

</div>

My app [FlowBits](https://homey.app/a/com.basmilius.flowbits/) has a randomized timer card. Your flow could look like this.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/6/d6e9e9e7b2c4d4319b6d92f28080d9f5340760ac.png)

---

<div class="post-metadata">

### Author: ![Anoniemand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anoniemand/32/120697_2.png) [@Anoniemand](https://community.homey.app/u/Anoniemand)
#### Post date: [February 10, 2026, 12:01pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/4 "2026-02-10T12:01:05Z")

</div>

Lol i was just editing my own post with that suggestion 😛

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [February 10, 2026, 12:05pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/5 "2026-02-10T12:05:34Z")

</div>

![Scherm­afbeelding 2026-02-11 om 11.16.29](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/2/b2861a1227721fc0bfaaa9d6080ed59d9345ca3e.png)

---

<div class="post-metadata">

### Author: ![Tiengemeten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiengemeten/32/78864_2.png) [@Tiengemeten](https://community.homey.app/u/Tiengemeten)
#### Post date: [February 10, 2026, 3:49pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/6 "2026-02-10T15:49:00Z")

</div>

Thanks for the Flowbits tip!

---

<div class="post-metadata">

### Author: ![Tiengemeten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiengemeten/32/78864_2.png) [@Tiengemeten](https://community.homey.app/u/Tiengemeten)
#### Post date: [February 10, 2026, 4:11pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/7 "2026-02-10T16:11:37Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)
#### Post date: [February 10, 2026, 4:25pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/8 "2026-02-10T16:25:45Z")

</div>

Right-click the card and select reverse (omkeren)

---

<div class="post-metadata">

### Author: ![Tiengemeten](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiengemeten/32/78864_2.png) [@Tiengemeten](https://community.homey.app/u/Tiengemeten)
#### Post date: [February 10, 2026, 4:35pm UTC](https://community.homey.app/t/how-to-play-a-sound-at-randomized-time-intervals/150903/9 "2026-02-10T16:35:15Z")

</div>

Ah yes, of course 🤦

Thank you!
