# Play regular beep while mopidy is idle

**URL:** <https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181>\
**Category:** Misc\
**Created:** [October 25, 2021, 8:29am UTC](https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181 "2021-10-25T08:29:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thorwil](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@thorwil](https://discourse.mopidy.com/u/thorwil)\
**Post date:** [October 25, 2021, 8:29am UTC](https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181/1 "2021-10-25T08:29:08Z")

</div>

Hi,

Is there a way to make mopidy play a sound (like a beep) every n seconds when nothing else is playing? I regularly forget to switch of my HIFI when leaving the house. 🙂

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [October 25, 2021, 9:26am UTC](https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181/2 "2021-10-25T09:26:03Z")

</div>

There’s nothing I know of that does this currently, but you could write a script or even Mopidy extension that did this.

For a script, check Mopidy’s status to see if it’s playing something (or use MPD’s `idle` command), if not then play your beep sound and sleep for n seconds. The `mpc` program in conjunction with Mopidy-MPD makes writing these scripts quite simple.

---

<div class="post-metadata">

**Author:** ![thorwil](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@thorwil](https://discourse.mopidy.com/u/thorwil)\
**Post date:** [March 10, 2022, 7:21pm UTC](https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181/3 "2022-03-10T19:21:34Z")

</div>

In case anyone else is interested; here is a simple implementation of it:

```auto
#!/bin/bash
while true
do
  eval STATE=$(curl -d '{"jsonrpc": "2.0", "id": 1, "method": "core.playback.get_state"}' -H 'Content-Type: application/json' http://YOUR_IPADDRESS:6680/mopidy/rpc|jq .result)
  ["$STATE" != "playing"] && speaker-test -l 1 -t wav
  sleep 30
done

```

I start this from /etc/rc.local

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [September 9, 2022, 7:21am UTC](https://discourse.mopidy.com/t/play-regular-beep-while-mopidy-is-idle/5181/4 "2022-09-09T07:21:52Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
