Volumio2 icon indicating copy to clipboard operation
Volumio2 copied to clipboard

Automatic sleep timer to stop music playing after a set time

Open acjohnson opened this issue 3 years ago • 4 comments

Looks like someone thought of this idea quite awhile ago but it never received attention. https://community.volumio.org/t/collected-sleep-timer/2651

Sometimes I'll hit play on an internet radio station on my Volumio Pi and it will just keep playing endlessly. If I forget about it I'll wake up in the morning and find that my covered deck ceiling speakers are still playing the same internet radio station from the day previous.

It would be nice if in the Playback options I could select a duration to automatically stop playback regardless of the audio source. A dropdown with 1, 2, 4, 8, 12, 24 hours for example would be nice. Perhaps even add a check box that would turn off (power down) the volumio device for those who prefer that functionality.

acjohnson avatar Aug 23 '21 21:08 acjohnson

Hmm does Settings>Sleep not work for you?

ashthespy avatar Aug 24 '21 18:08 ashthespy

Not sure how I missed that; yes that works. Is there a way to save it as a persistent setting without requiring you to manually enable sleep each time?

acjohnson avatar Aug 24 '21 19:08 acjohnson

Is there a way to save it as a persistent setting without requiring you to manually enable sleep each time?

I do not believe so. But you should be able to patch something together as a startup script (if you want to see/cancel stuff from the WebUI) or a systemd timer service if you want something easy.

Something like this should get you up and running.

[Unit]
Description=Poweroff after xx hours from boot
# Call necessary service
Unit=systemd-poweroff.service

[Timer]
# Power off 
OnBootSec=5h 30min

[Install]
WantedBy=timers.target

ashthespy avatar Aug 25 '21 09:08 ashthespy

Thanks for the response @ashthespy that systemd job wouldn't do anything remotely like what I am asking for but that's ok.

acjohnson avatar Aug 26 '21 03:08 acjohnson