OSMC and Power management


I’m happy with osmc on my rpi2, but I’d like to change the way power management works.
I want my pi to be always running, but xbmc to be manually start and stop on inacitivy timer.

  • In the KODI power management page, I can’t change the function on “inactivity timer”. I want just exit kodi, not power the rpi down.

  • I guess rpi doesn’t support sleep or shutdown/wake by usb devices, right?

  • The “power” button on my MCE remote shut the pi down, whatever KODI is running or not. So I guess I have to tweak LIRC or the kernel to avoir the shutdown?

Change the keymap

We are already working on changing the power implementation


Can I ask why ? Seems pointless to me.

No. The Pi has no true power off ability, only the OS can be halted but the power remains on.

Can’t see how this is happening - the buttons from the remote are only passed through to Kodi, if Kodi is not running the power button on the remote should not shut the system down.

I’m using KODI for videos and MPD for audio (with a Hifiberry Digi+)
I need the mpd to be running 24/24, and kodi only when watching videos.

So I really need the Exit on inactivity feature :wink:

Ok, I will try it tonight but this morning, without kodi running, the rpi shutted down when I pressed the power button. (I don’t have any mapping on .lircrc for the power button)

Exiting Kodi won’t do what you want, because the watchdog script that runs Kodi will automatically restart it again after 10 seconds. If you want to stop Kodi semi-permanently you’ll need to use systemd to stop the service:

sudo systemctl stop mediacenter

I can’t see any easy way to do this due to inactivity though, although it would be possible to configure a menu option or remote button to call this command via a script.

I already have disabled the mediadenter service from startup sequence, so no watchdog.
I’m running kodi on demand, when I press the KEY_HOME button of my remote (thanks to irw).

The question is now to understand how to make the “shutdown function” enabled, to change behavior to “exit”.

So how exactly are you launching Kodi then ?

Just disabling the service for automatic startup does not disable the watchdog script - if you are manually starting Kodi with ‘sudo systemctl start mediacenter’ then when the service is started the watchdog script /usr/bin/mediacenter is active and will still restart Kodi 10 seconds after you exit Kodi.

So as I said, exiting Kodi is not sufficient. You would want to execute the shell command ‘sudo systemctl stop mediacenter’.

Or are you running kodi.bin directly without the watchdog script ? If so, be advised that there is a lot of stuff in /usr/bin/mediacenter that really needs to be run for Kodi to work properly.

yes, I’m running kodi without the watchdog, using this script:

# Test to see if XBMC is running first
if ps -ef|grep -v grep|grep -i kodi.bin
# Do nothing
echo KODI already Running!]
# Startup Kodi
#sudo systemctl start mediacenter

What are the stuffs missing from the watchdog?
XBMC is running fine for now.

Hi Mika,

I saw you posting on Volumio, wanting to combine a web based audio player with Kodi.
This is exactly what I want, and now it looks you got it running based on OSMC!

Good you give me some tips on what you did to get it working?




I made some searchs and tests to achieve a KODI + MPD rpi.
The different approachs I tried:

  • RuneAudio + Kodi: based on arch linux and not a big community
  • Volumio + kodi: worked but dist is not optimized for rpi2 and use stock kodi
  • Openelec + MPD: addon seems to not be working anymore
  • OSMC + MPD: working, but need to do more tests/tweaks

Please be aware that I’m using MPD with upnp frontend only, not the web based gui.

All I basicaly did was to install osmc, then add upmpdcli repository (http://www.lesbonscomptes.com/upmpdcli/downloads.html#install)
and run

apt-get update
apt-get install mpd mpc
apt-get install upmpdcli

After that, I configured my MCE remote to start/stop kodi when pressing the MEDIA key, in order to free memory and cpu when not watching videos.

Now I’d like to compare stock MPD package with volumio’s one, and maybe port webui.
But I’ not a linux nor a git guru, so I think it will be difficult for me to compile a “tweaked” MPD package.

Hi Mika,

I based my install on the following tutorial.
I messed it up a few times and perfected the steps in between installs (still looking for a backup method of all config related files of volumio, to ease the steps).

I almost got it running. Only the volume control on the webpage is not worling yet and I am looking at a way to keep the path to my nas as short as possible (now two taps too much, but tweaking destroyed once my db).

But I’m getting there, roughly based on the steps in the linkt!

Your setup seems a lot easier, but the result is what matters, so if this works for you, great!

Nice job on shutting down osmc to get more memory, allthough I think we have more than enough resources, but maybe I will look into that on a later stage!

Osmc is by the way a great setup, got it running with plex, runs great!



Thanks for this helpfull link.
I succeeded to compile mpd-volumio package yesterday, on my OSMC build.
The package installed successfully, but upmpdcli can’t connect to it. So I revert back to official debian MPD package.
I will try to understand why next week, then install webui with your link.

I’m also interested to find out what’s missing. I would like to be able to run Kodi on-demand using the Green button on my remote too. I’m running other applications that I would like to run 24/7 but have no need for kodi to run all the time using up precious CPU cycles and memory.

I see that you commented out “sudo systemctl start mediacenter” in your script; wouldn’t this have been the best way to run it in order to avoid missing whatever is supposed to be missed out by running kodi-standalone directly? Then exit it using sudo systemctl stop mediacenter!

Also, please explain how you got the Green button to launch the script using irw?

Many thanks in advance.

Indeed, I changed the script and use “systemctl mediacenter” now.
I previously shut kodi down using the media remote button, but now I comment it on remote.xml confidential file, and use irw to shutdown too.

I’m not at home today so I can’t give you precise details, but you have to write a .lircrc file in your home directory, and map the green button with the startup scipt.
And don’t forget to run irw on startup, using the osmc user. (I’m using rc.local with a ‘su osmc irw’ command)

Thanks for replying. Please do elaborate when you get a chance :smile:

Hi there,
I’m interested in too to be able to start/stop Kodi when I use my reboot on/off button (or another one).
Can you please help @mika91?
@thecrater did you find out?