Kodi Community Forum
Kodi on libreelec keeps connection to tvheadend open - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: PVR & Live TV Support (https://forum.kodi.tv/forumdisplay.php?fid=167)
+---- Forum: Tvheadend (https://forum.kodi.tv/forumdisplay.php?fid=168)
---- Thread: Kodi on libreelec keeps connection to tvheadend open (/showthread.php?tid=328540)



Kodi on libreelec keeps connection to tvheadend open - cake4 - 2018-02-15

Sorry to start into the forum by a beginners question. Could not find a solution.

I have libreelec (devel-20180212221729-#0212-g760c839) running on a raspberry with tvheadend (4.2.5) on a separate server (ubuntu) with several dvb cards for pvr/livetv. Everything runs quite good.

There is only one problem. The process kodi.bin on the libreelec system keeps an active connection to my tvheadend server at port 9982 even if libreelec/kodi is idle/not in use. My tvheadend machine therefore is being kept from getting into suspend2ram mode. If I ignore the connection on my tvheadend system there are problems after remote wake, with epg updates, live tv and so on...

Is there a way to put kodi in "sleep mode" on the rpi (without turning it off)? Is there a recommended or best practice setup for the scenario?


RE: Kodi on libreelec keeps connection to tvheadend open - -chris- - 2018-03-14

I have the same problem.

Client: Raspberry Pi 3, OSMC 2018-02 (4.14.15-5-osmc)
Server: x86 PC, Ubuntu 16, Tvheadend 4.2.5

My kodi installation has multiple profiles; only one of them, named tv, has a valid tvheadend configuration. Even after logging off this profile, a connection between the Pi and the Tvheadend server persists on port 9982. This prevents the server machine from suspend.

I remember that this didn't happen in a different environment (older versions of Tvheadend and Kodi on a different box running Windows).


RE: Kodi on libreelec keeps connection to tvheadend open - lokum - 2018-04-10

There's no nice way to do this in my experience.  You can try disabling pvr.hts on idle, but I find when you re-enable it after idle (using a json thingybob) kodi crashes.  You can disable the network adaptor on the pi on idle and re-enable it after idle, but this causes crashes too.  I don't know if running a script which stops kodi on idle then restarts it on resume would work with an ir remote.  It might do.


RE: Kodi on libreelec keeps connection to tvheadend open - -chris- - 2018-04-10

I found a workaround:
 
  • the tv profile has separate media databases (so that add-ons are configured independently)
  • the Tvheadend plugin is enabled in tv
  • the Tvheadend plugin is disabled in the master profile

When I'm finished using the tv profile, I change to the master profile. This disables the Tvheadend plugin and the connection is closed, without crash.

I also tried to just log off the tv profile and stay in the profile selection screen, but this does not disable the Tvheadend plugin so that the connection stays opened.


RE: Kodi on libreelec keeps connection to tvheadend open - lokum - 2018-04-10

That sounds ingenious - will give it a go later and report back.

edit.  I've set it up with Kodi Callbacks so that when the screensaver is active it executes the builtin function XBMC.LoadProfile(profile_with_no_tv_client).  For that profile I've set the keymap for every key on the remote to XBMC.RestartApp.  I've set the default login to the Master profile which has the TV client active.  I did try using XBMC.LoadProfile(Master) instead of restarting Kodi but it was crashing.  This is a decent compromise.  Thanks -chris- !


RE: Kodi on libreelec keeps connection to tvheadend open - cake4 - 2018-04-14

(2018-04-10, 06:23)lokum Wrote: That sounds ingenious - will give it a go later and report back.

edit.  I've set it up with Kodi Callbacks so that when the screensaver is active it executes the builtin function XBMC.LoadProfile(profile_with_no_tv_client).  For that profile I've set the keymap for every key on the remote to XBMC.RestartApp.  I've set the default login to the Master profile which has the TV client active.  I did try using XBMC.LoadProfile(Master) instead of restarting Kodi but it was crashing.  This is a decent compromise.  Thanks -chris- !
I found a way to switch back to master profile without restarting kodi. The callback XBMC.LoadProfile(Master user) works for my setup. It is activated by kodi callbacks on event onScreenSaverDeactivated (instead of remapping keys). The exact line in settings.xml is
<setting id="T1.builtin">XBMC.LoadProfile(&quot;Master user&quot; )</setting>
Switching to profile "Dummy", that does not have tvheadend configured (actually has no media at all), is done by kodi callbacks event onIdle:
<setting id="T1.builtin">XBMC.LoadProfile(&quot;Dummy&quot; )</setting>
This seems to work quite good.
Thanks for the idea with profiles!


This forum uses Lukasz Tkacz MyBB addons.