Kodi Community Forum
Python - Wait for CEC command? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+--- Thread: Python - Wait for CEC command? (/showthread.php?tid=139786)



Python - Wait for CEC command? - matthuisman - 2012-09-05

Hi,

Basically, I have a Raspberry Pi that I have powered on all the time.

I am wanting to write a python script that puts XBMC (& the Pi) into a "sleep" state.
This will spin down the harddrives and a few other things to "save power" and most importantly - make no noise.

Is there any python functions to wait for a CEC command? or a XBMC specific command.
Eg: wait for "suspend" command (which Pulse Eight calls) - then the script will catch this and run.
Currently - suspend does nothing on the RPI.

Easier yet would be changing the Pulse Eight to call the python script directly.

I would then want XBMC to "wake up" if the TV powers on or WOL (if I need to access the harddrives from my PC)

Any ideas?



RE: Python - Wait for CEC command? - sialivi - 2012-09-05

Doesn't Pulse Eight's libCEC already do all this without the need for a python script?


RE: Python - Wait for CEC command? - matthuisman - 2012-09-05

Yes, it can put XBMC into a "suspend" mode or shutdown.

However, suspend on the RPI does nothing.
So, i was going to write a python service to wait for a "suspend" command and then spin down hard-drives etc.

Shutdown on the RPI does spin down the hard-drives.
However, there is no way to wake it back up without unplugging.

The propper soultion would be that the RPI has a propper suspend function that spins down hard-drives etc.
Then waits for keypress / CEC command / WOL


RE: Python - Wait for CEC command? - bobbintb - 2012-09-10

not that this is what you were asking but out of curiosity why do you keep it powered on all the time? i just have mine powered through the usb service port on my tv to it turns on and off with the tv.