[MOD] Alarm & Sleep

Suggestions/requests/ideas for RuneAudio core features and functions

[MOD] Alarm & Sleep

Postby restinpieces » 11 May 2017, 12:50

Alarm & Sleep

Alarm Features:
- Multiple alarms
- Set time, playlist, day of the week, volume and fade time
- Changing the Volume during fade in stops fading
- Timeout after 1h playing without interaction during fade in

Sleep Features:
- Select the after run time
- Change the volume as you like, the new fade parameters are calculated on the fly



alarm1.png
alarm1.png (48.94 KiB) Viewed 5206 times

alarm_sleep_2.png
alarm_sleep_2.png (19.48 KiB) Viewed 5257 times



How To:

The mod was built on "RuneAudio_rpi2_rp3_0.4-beta_20170229_2GB" I haven't tested it on other versions.

For some reason I could only get "cronie" and "at" to work by reinstalling them:

Code: Select all
pacman -R cronie
pacman -S cronie
pacman -R at
pacman -S at


Start and enable them at boot:

Code: Select all
/usr/bin/systemctl start cronie && /usr/bin/systemctl enable cronie && /usr/bin/systemctl start atd && /usr/bin/systemctl enable atd


Copy the archive to /var/www
alarm_sleep_1v2.tar
(50 KiB) Downloaded 581 times



Extract the archive
Code: Select all
cd /var/www
tar -xvf alarm_sleep.tar



Update runeaudio by going to /dev/ and clearing opchache and restarting "RuneAudio SYSTEM Worker (rune_SY_wrk)"



Hope you like it.
-rip-
Last edited by restinpieces on 16 May 2017, 22:29, edited 1 time in total.
restinpieces
 
Posts: 19
Joined: 28 Feb 2016, 22:26

Re: [MOD] Alarm & Sleep

Postby restinpieces » 13 May 2017, 18:21

V1.1
- Styled checkboxes
- Added a stop sleep timer button
restinpieces
 
Posts: 19
Joined: 28 Feb 2016, 22:26

Re: [MOD] Alarm & Sleep

Postby hondagx35 » 14 May 2017, 11:34

Hi restinpieces,

thank you for posting this.

Looks good and works fine.
One issue i found is with using hardware volume.
When I set the volume to 1 mpc reports volume level as 2

Code: Select all
 mpc volume 1
Daft Punk - Giorgio By Moroder - Daft Punk / Giorgio Moroder
[playing] #51/75   8:37/9:05 (94%)
volume:  2%   repeat: off   random: off   single: off   consume: off


This will stop your script because it thinks user has changed volume.
I fixed this with:
Code: Select all
      #end fade if user changed volume
      Diff=$(($CURRENT_VOLUME - $VOLUME)) ;
      if [[ ${Diff#-} -gt 2 ]] ; then
         exit 0 ;
      fi;


Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: [MOD] Alarm & Sleep

Postby restinpieces » 15 May 2017, 22:15

I think its generally a good idea to have a small threshold. Does your code work with positive and negative Diff? (I'm not the greatest shell programmer)
restinpieces
 
Posts: 19
Joined: 28 Feb 2016, 22:26

Re: [MOD] Alarm & Sleep

Postby hondagx35 » 16 May 2017, 09:05

Hi,

Does your code work with positive and negative Diff?

Yes it does because
${Diff#-}
gives you the absolute value.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: [MOD] Alarm & Sleep

Postby restinpieces » 16 May 2017, 22:33

V1.2 Bugfixes
- Sleep fade calculation was wrong
- Sleep page didn't correctly reload
- Fade in exit condition now with threshold (thx hondagx35)
restinpieces
 
Posts: 19
Joined: 28 Feb 2016, 22:26

Re: [MOD] Alarm & Sleep

Postby Stephane » 22 May 2017, 20:43

Hello,

Tested on my garage player with a 7" screen, it works after reinstalling cronie and at as stated.
Thank you for your work.
Stephane
 
Posts: 64
Joined: 06 Feb 2017, 10:35

Re: [MOD] Alarm & Sleep

Postby lakeuk » 20 Jun 2017, 17:02

Excellent mod/instructions, could the alarm/sleep have an option to not use the fade, volume level stays constant
(Pi 3, Ver. 0.4b build 20170229, usage m3u radio streams playlists)
lakeuk
 
Posts: 14
Joined: 20 Jun 2017, 16:54

Re: [MOD] Alarm & Sleep

Postby restinpieces » 02 Jul 2017, 12:47

lakeuk wrote:Excellent mod/instructions, could the alarm/sleep have an option to not use the fade, volume level stays constant


I thought about a 0s fade for the alarm but I hate the option to give someone a heart attack by 0s fade an 100 volume either accidentally or intentionally. That is why there is a minimum fade of 1min.


For the sleep timer I don't see any use of no fade. If I just turn it off at the end I wake up. But maybe you have another use in mind?
restinpieces
 
Posts: 19
Joined: 28 Feb 2016, 22:26

Re: [MOD] Alarm & Sleep

Postby lakeuk » 04 Jul 2017, 22:18

Last week I tinkered about with the alarm template and added 0 to the array, works a treat. I'm ok having a set volume with no fade in, I don't have it loud enough to shock me, got a bedside alarm clock to do that for me 10 minutes after the runeradio goes off. Once first alarm of the day goes off I use the alarm as a scheduling function, switching to radio stations that I'm interested at certain times of the day.

Got a surprise when the sound stopped after an hour so in mpcfadectl.sh I've upped the timeout to 240minutes. I've starting adding to the template a timeout section, not yet fed it through to the shell script.

I'll look at the sleep again, just tried the 5min and noticed the volume going down straight away, on my RaspPi sound is only heard in the 80-100% range, once a minute passes silence.
Attachments
templates.zip
Alarm.php - 0 added to fade, timeout dropdown placeholder for future. Sleep.php - extra buttons upto 240mins
(6.13 KiB) Downloaded 453 times
(Pi 3, Ver. 0.4b build 20170229, usage m3u radio streams playlists)
lakeuk
 
Posts: 14
Joined: 20 Jun 2017, 16:54

support RuneAudio Donate with PayPal

Next

Return to Feature request

Who is online

Users browsing this forum: No registered users and 1 guest