pip install not found?

  • I've got an amp that can be commanded via rs232. What I would like to do is build that capability into my Kodi box which is already co-located with the amp. Problem is, I cant pip install anything and need the python serial library to script this out. Don't have a ton of experience with this distro but getting the feeling that development on a Libreelec is highly discouraged.

    Ultimately I would like to host a small web app that runs python scripts on the back end. Am I wasting my time trying to get this to work on Kodi or is there a reasonably straightforward way?

  • I assume you want to connect an RS232 interface to the serial GPIO pins of an RPi. To get the Python GPIO library, all you have to do is to install the "Raspberry Pi Tools" add-on. Start your Python script with this lines to import that add-on lib:

    Python
    #!/usr/bin/python
    
    import sys
    sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')
    import RPi.GPIO as GPIO
  • I faced the same problem recently, CEC was too unreliable to determine tv state, I spun up a quick python docker with pyserial and it worked nicely but running the scripts on libreelec to the docker was hassle and a bit overkill for what i needed it for, so ended up creating an add-on to pull the required modules.

    Don't know if your up for that challenge, but if not you could try downloading the Hello World Tutorial GitHub - zag2me/script.hello.world: Hello World Add-On Script for Kodi/XBMC and modify the requires section in script.hello.world/addon.xml at master · zag2me/script.hello.world · GitHub to pull the modules you need, zip it then install it on libreelec

    Code
    <requires>
    <import addon="xbmc.python" version="2.25.0"/>
    <import addon="script.module.routing" version="0.2.0"/>
    <import addon="script.module.pyserial" version="3.4.0"/>
    <import addon="script.module.requests" version="2.22.0"/>
    <import addon="script.module.chardet" version="3.0.4"/>
    <import addon="script.module.certifi" version="2019.9.11"/>
    <import addon="script.module.idna" version="2.8"/>
    </requires>

    Here is a snippet to show it in action, the 01 is showing the TV is on, It initially wouldnt work as i couldnt add root to the dialout group so ended up changing ownership of /dev/ttyS0 to root

    The other option could the install the System Tools add-on from Libreelec repo and use screen instead of pyserial

    Code
    screen /dev/ttyS0 9600,cs8

    :thumbup: