Sleep timer for O!Play with AMP12 Working

Sleep timer for O!Play with AMP12 Working

Postby badkarma » 02 Mar 2015, 01:16

Hello,

I have implemented a hard-coded "30 MINUTE SLEEP TIMER" for my OPlay HDP-R1 with AMPr12.

It may be useful for others as I know other people have asked and I would like to know how I can customise it even more.

What I have done so far (hard-coded 30 minute sleep timer):

I do not use the REPEAT/CONFIRM button on my HDP-R1 remote control so I have configured this to tell my O!Play to switch off automatically after 30 minutes (so I can fall asleep watching movie and know that the O!Play will switch off after 30 minutes, and not then continue to play all remaining movies in the same folder on my NAS).

This allows my NAS to also sleep after +5 mins from the O!Play going to sleep.

This then saves electricity of running O!Play and NAS and HDD drives working all night playing all my other movies in the same folder as the movie I was watching when I fell asleep. Everything falls to sleep after 35 minutes :D

To do this:

- TELNET to your O!Play and login with root
- Then change into the irfake subfolder and edit irfake.conf with the vi editor as follows:

Code: Select all
cd /usr/local/etc/irfake
vi irfake.conf


- scroll down to the OPlay R1/R2 section (it has the following header):

Code: Select all
...
...
# O!Play R1/R3 section
...
...


- copy the line for REPEAT -> CONFIRM within the PLay R1/R3 section as a backup, then comment out the original line, then modify the second line as follows:

Code: Select all
#"0","a55a686c","b14e9f00",   REPEAT -> CONFIRM
"1","a55a686c","/usr/local/etc/irfake/drift &",   DRIFT


- Then save irfake.conf

Hint:
"0" means replace infrared code "X" with infrared code "Y"
"1" means ignore infrared code "X" (from my button) and instead, run a script!)
(See IRFake docs for more info on this config file)



Back at the shell prompt, vi a new file called 'drift' in the same folder as irfake.conf

In the drift file, enter the following:

Code: Select all
sleep 1800
echo "0xa8579f00" > sys/devices/platform/VenusIR/fakekey


Then save the file

Hint:
This file, when it runs, will put itself to sleep for 30 minutes (30 * 60 seconds = 1800) :) and then it will execute the second line which puts the OPlay to sleep by mimicking a "Power off button press".



Then make the drift file executable by the command:

Code: Select all
chmod 0777 drift


Then reboot the O!Play.

Now if you press the REPEAT/CONFIRM button, the O!Play will sleep in 30 minutes after you pressed the REPEAT / CONFIRM button! :)

NOW MY NEXT CHALLENGE!

I would like the "drift" script to do the following instead of a 30 minute hardcoded sleep: (pseudocode):

Code: Select all

MySleepTime = 0

If FileExists (SleepTimerDataFile)
    {
        MySleepTime = getTimeFromSleepTimerDataFile()
    }

MySleepTime = MySleepTime + 600

if (MySleepTime > 3600)           // if Sleeptimer is greater than one hour, cancel sleep timer
{
   MySleepTime = 0
   Delete MySleepTimerDataFile
   Kill All drift scripts currently running
   echo "Sleep Timer Cancelled" > TVscreen
   exit script
}

if (MySleepTime > 0 and MySleepTime < 3601)
{
   echo "O!Play will sleep in " + (MySleepTime / 60) + " minutes!" > TVscreen
   WriteNewSleepTimeToSleepDataFile
   Kill All drift scripts currently running
   sleep MySleepTime
   echo "0xa8579f00" > sys/devices/platform/VenusIR/fakekey
}
 



My main question is: Can I write a message to the TV screen letting the user know the current sleep status (10 min / 20 min / 30 min / 40 min / 50 min / 60 min or 'Sleep cancelled')?
ASUS O!PLAY HDP-R1 with AMPr12.5
badkarma
 
Posts: 4
Joined: 29 May 2013, 22:53

Return to About Asus O!Play

Who is online

Users browsing this forum: No registered users and 2 guests