Stopping Kodi to free resources

The reason I bought a meecool K1pro is that it is way cheaper than any other solution to run
a TVheadend server with DVBS2 and DVB T2 tuners.(with box , psu and remote as bonus)
I’m using 2 additional RTL2832 dongles for DVBT.
It worked first time with coreelec.
Thus I can access and record any of more than 1000 channels with VLC on any device on my LAN.
When the main TV is not used I need to take care that it doesn’t stay on a DVB S2 channel
because the only tuner is not usable on the network any more.
Same if it stays on an ADSL channel using a good part of my poor connection.
There is no simple way to free the resources.
May be with SSH it is possible but not as simple as it could be.
The CEC function could be a solution but it seems it shut down everything with the TV.

I don’t understand. If you want to run the K1 “headless”, you can probably add systemctl stop kodi in the autostart.sh file.
If you want to “close” Kodi when you aren’t using the box (which makes very little sense to me), you can SSH into it and send the systemctl stop kodi manually.
To start Kodi back up send systemctl start kodi.
I’m pretty sure that there are smartphone apps that can do this. You setup a shortcut for close and for open Kodi. Tap and it will send the appropriate SSH command.
CEC is only usable from within Kodi, so you can’t use it to close/start Kodi.

Hi thanks for the quick answer.
Sorry if my request was not clear
Yes I can use SSH . I just tried it . Perfect.
But it is complicated : PC + putty + password.
But I understand that if Kodi is closed SSH seems to be the only way to start it again
The remote seems useless with Kodi closed.
That’s exactly what I would like to do with just the K1 remote.
Using another K1 headless is another possibility but the problem stays
if a coreelec client is on but used only as a NAS it can keep a tuner busy for nothing .

I think you have to only stop play live tv channel in kodi (prees stop button on mecool RC) and then switch off TV set.

systemctl mask kodi

Then Kodi will no longer start

I might be missing something here, but unless you’re actually playing a channel I can’t see how a tuner is being kept busy. That doesn’t happen in my network.
Do you need actually need to stop kodi, or would disabling your pvr client be enough, or would simply stopping playback do it?

Is the TV using Kodi to display the channel?
Wondering what is keeping the channel/tuner locked to the TV.

I use a cheapo Tanix TX3 mini headless for similar purpose, but all devices use Kodi, and unless they are actually displaying a channel the tuner is free to be used by other devices.

Maybe it is time to consider adding a couple of Sat>IP tuners to the mix :wink:

“[afl1]
I think you have to only stop play live tv channel in kodi (prees stop button on mecool RC) and then switch off TV set.”

I think you are right.
Up to now I was misguided by the fact that even when displaying the stop menu the TV signal was still playing in the background.
The only way I found to free the tuner was to play a file that involved a lot of key press.

@Arthur Make a file “Remote.sh” in ~/.config/ and using your favorite editor, add the following text to the file and save it.

#!/bin/sh
enabled=$(ps -ef | grep -v grep | grep kodi.bin | wc -l)
if [[ $enabled == “0” ]]; then
systemctl start kodi
else
systemctl stop kodi
fi

Using “chmod +x Remote.sh” make this file executable.
Then create and edit ~/.config/lircrc with the following text:

begin
prog= irexec
button= KEY_RECORD
config = /storage/.config/Remote.sh
end

You will have to change the button that you are using. I am using KEY_RECORD
You can use whatever you like. Try typing “irw” and enter. Then, press your desired key on the remote. The key will show up on the screen. Replace KEY_RECORD with that key.

Finally add the following command to ~/.config/autostart.sh (which should be an executable)
“irexec -d;” without quotes. So that lirc can intercept that key and execute this instruction.

1 Like

Excellent and thank you.

Thanks codwapeace I tried your solution but irw doesn’t react at all so nothing happens
The command:

root@MECOOL:/bin$ ./ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event3) with:
Name: Realtek RTL2832U reference design
Driver: dvb_usb_rtl28xxu, table: rc-empty
lirc device: /dev/lirc0
Supported protocols: other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
Enabled protocols: lirc
bus: 3, vendor/product: 0bda:2832, version: 0x0100
Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event4) with:
Name: Realtek RTL2832U reference design
Driver: dvb_usb_rtl28xxu, table: rc-empty
lirc device: /dev/lirc1
Supported protocols: other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
Enabled protocols: lirc
bus: 3, vendor/product: 0bda:2838, version: 0x0100
Repeat delay = 500 ms, repeat period = 125 ms

seems to indicate that the IR receiver incorporated to the K1pro doesn’t use lirc