Kodi Community Forum

Full Version: OUYA: Always on box, TV Standby on screensaver?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I recently bought an OUYA to use as a XBMC client in the bedroom. I plan to leave the OUYA on all the time, and I would like it to put the monitor into standby if I fall asleep watching something instead of just going into screensaver.

The OUYA is connected to an LG Monitor, not a TV so there is no remote control for the screen. I have selected the "Black" screen saver add-on within SPMC but still at the moment the screen sits for 6 hours or so a day with the back light on unnecessarily while I sleep!

Are there any add-ons or any way to turn off the HDMI port or do whatever is necessary for my panel to go into power save mode?
I'm actually in the same boat, and was just thinking about how I might hack something together to put OUYA into standby mode, triggered by XBMC's idle/sleep timer. It's possible, if you don't mind installing some mods (I think. I don't have a working solution just yet).

I'll update this thread if it goes anywhere :)
If some devs are looking for pointers, I know for sure there is an intent specific to ouya to put it to sleep.

One has to dig into their sdk.
(2014-02-03, 03:12)Koying Wrote: [ -> ]If some devs are looking for pointers, I know for sure there is an intent specific to ouya to put it to sleep.

One has to dig into their sdk.

I downloaded some generic app from the Google Play store for phones that locks the phone when you open it, and that seemed to put the OUYA to sleep (at least it turned my monitor off). I was thinking some simple script with an idle timer that just launches that app might work, but I'm open to something more elegant.
(2014-02-02, 22:58)Ned Scott Wrote: [ -> ]I'm actually in the same boat, and was just thinking about how I might hack something together to put OUYA into standby mode, triggered by XBMC's idle/sleep timer. It's possible, if you don't mind installing some mods (I think. I don't have a working solution just yet).

I'll update this thread if it goes anywhere Smile

I hacked something together for the R-Pi which could be made to work for the Ouya as long as there is a way to enable, disable and determine the status of the HDMI (ie. an equivalent of the tvservice binary on the Pi) - either specify the binary directly or use a "proxy" that could translate the tvservice --preferred (hdmi on), --off (hdmi off) and --status (hdmi status) commands that are being issued. At the very least it's a proof of concept if someone wants to write a service addon that does the same.

The problem is, however, that once the HDMI is disabled XBMC requires a restart for HDMI to be re-enabled (under 15 seconds on a 1GHz Pi with OpnELEC, so not a major issue most of the time). Presumably Ouya will have a similar requirement?

If the Ouya supports a "sleep" mode (the Pi doesn't) then putting the Ouya to sleep is a better option.
I downloaded Screen Off and Lock from the Play store and it works if I open it from within XBMC. When I press a button on the controller or USB remote, it wakes up and is still on XBMC.

I don't know much about python, but I'm guessing this just needs to be triggered with the screen saver:

Code:
StartAndroidActivity(com.katecca.screenofflock)
(2014-02-03, 20:52)Ned Scott Wrote: [ -> ]I downloaded Screen Off and Lock from the Play store and it works if I open it from within XBMC. When I press a button on the controller or USB remote, it wakes up and is still on XBMC.

I don't know much about python, but I'm guessing this just needs to be triggered with the screen saver:

Code:
StartAndroidActivity(com.katecca.screenofflock)

One thing I've noticed is that the screensaver is able to start when music is being played, so you wouldn't want to suspend the device while a player is active. Nor would you want to suspend the device in the middle of a library scan. So you need a means of delaying the suspend until the player stops/scanning ends, only suspending the device once it becomes idle and if the screensaver remains active.
Didn't test, but i had something similar laying around:

Code:
import xbmc

delay = int(2) # start 2 minutes after screensaver starts
delaySec = delay*60
lastCheck = 1

while not xbmc.abortRequested:
    if xbmcPlayer.isPlaying() or (xbmc.getCondVisibility("Library.IsScanningVideo")) or (xbmc.getCondVisibility("Library.IsScanningMusic")):
        lastCheck = 1
    elif xbmc.getCondVisibility("System.ScreenSaverActive") and lastCheck >= delaySec:
        xbmc.log('Starting screenofflock')
        xbmc.executebuiltin('StartAndroidActivity("com.katecca.screenofflock")')
    lastCheck = lastCheck + 60
    for _ in xrange(60):
        time.sleep(1)
Hey guys,
I never had notifications set on this thread! Sounds like a possible plan. How would I go about running that python script on the OUYA and I'll give it a test!
Any pointers on how to implement this would be appreciated. I looked at the python section on the wiki, but I still cant grasp where to put this so it would be triggered when the screen saver fires