[HOW-TO] Stop/Pause playback on Tv OFF

Hi all. I want to share my experience with the community.
If you are like me, you probably need to automatic stop playback (or pause) when your tv is off.
Usually i need because i watch kodi before i sleep, my tv turn automatically off, but playback will continue. If i was watching a tv series or a movie it’s not a big problem, but if’m watching TV (with pvr addon), it will never stop and continue playing overnight (and day after too), until i turn on my tv. Not the best i think.

So i found an old option in KODI (missing in osmc), that work with CEC. You can tell Kodi when your TV is off and it stop (or pause) playback.
To activate this option i needed to modify peripherals.xml file.
The only problem is that we will lose this MOD on OSMC update, so i ask @sam_nazarko if we can make this modification permanent, inside an update or simply preventing update to overwrite.

I’m going to write exact procedure for those who need.

Assuming we’re in SSH session we do following:

sudo nano /usr/share/kodi/system/peripherals.xml
find line
setting key=“standby_pc_on_tv_standby” type=“enum” value=“13011” label=“36029” order=“8” lvalues=“36028|13005|13011”
and add at the end 36043 and 36044 , resulting this:
setting key=“standby_pc_on_tv_standby” type=“enum” value=“13011” label=“36029” order=“8” lvalues=“36028|13005|13011|36043|36044”

Save, exit from nano, restart kodi with: sudo systemctl stop mediacenter then sudo systemctl start mediacenter
When Kodi starts we have to go in settings, system, input devices, peripherals, CEC adapter. Here we find option named “When the TV is switched off”, and we can finally choose to stop or pause playback.

I hope this will help community, and i hope @sam_nazarko will make this permanent.

Sorry if I 'm being obtuse, but there seems to be something missing here - like what do we search for, and what are the before and after states of the relevant line(s)
Derek

1 Like

yes, thank you for write. I’m going to edit.

edit:
It was not visible because of chars present.

There’s a PR open to reinstate this behaviour; but I haven’t looked at it yet as I wanted to make sure it merged cleanly for all devices. I will try and get this included by default in the next update.

Sam

It shouldn’t create problems, but you can always leave “ignore” setting as default, so it doesn’t change for all devices, except for those who want to activate It.

I want to make sure it can be used as a patch for all devices without merge conflicts; as it should probably be there already.

Sam

To ensure your changes are applied correctly and consistently it is best to stop kodi before editing the file and start it after the file is saved, rather than restarting after the edit as Kodi has a habit of writing to files during it’s stop process.

To be safe the order should be:

sudo systemctl stop mediacenter
sudo nano /usr/share/kodi/system/peripherals.xml
change the appropriate line
Ctrl+O, Ctrl+X
sudo systemctl start mediacenter

Man, I was looking for this setting and wondered why it wasn’t there. Just happened to stumble upon your post :slight_smile: Thanks so much!!!

Just saw this thread and I like the idea very much… Maybe it would be possible to have a settings option for this to enable or disable the playback pause/stop option via the GUI?

I’m glad i could help :slight_smile:

If you’ll follow my how-to an option will appear in the GUI. Anyway at the end of my first post i ask @sam_nazarko if it could make this permanent, obviously without the need of entering ssh and doing this procedure. Sam told he was already working on it and probably he will include as default in next update.

1 Like

Just to let you know that this should now be fixed in the next update. It seems an OSMC patch fell out of sync with upstream, so it was removing these options.

Sam

1 Like

Great job… as usual :slight_smile: