[Release] GPIO Monitor Service KODI Add-on



Here is handy add-on I created to monitor a GPIO pin on the Raspberry Pi.
Once the pin is pulled high or low, a configurable KODI function is run.


How to Install

First follow THIS post to install my KODI Add-on Repository.

Now navigate to "Main Menu -> Add-ons -> My Add-ons"
Select ".." then select "Install from repository"
Select "MattHuisman.nz Repository".
Select "Services" then "GPIO Monitor"

Now select "Install" and the add-on will download and install.


Follow the prompts to install the required RPi-GPIO Library.

Enjoy!


Configuration

The pin, edge and function can all be set in the add-on settings.


The Pin can be anything from 1 to 40 (default is 0 = Disabled)
It uses the board pin numbering (Gray numbers below)


The edge can be Falling (default) or Rising.

Falling will trigger when the pin goes from High to Low.
Rising will trigger when the pin goes from Low to High.

Note: Some pins have built-in pull up resistors so it's best to use Falling with these pins.

The Function can be any of the KODI build-in functions:
http://kodi.wiki/view/list_of_built-in_functions

The default is "ShutDown"
Other handy functions are "Reboot" & "RunAddon(id)".

No Notifications simply hides the pop-up message when the function is run.

Comments

  1. Hi Matt, thanks again for all your help!

    For some reason I don't understand (but I'm not good at coding either XD), I had to change with thing on your script from
    if state != last_state and state == EDGE:
    to
    if state != last_state and state != EDGE:
    Otherwise, LE will execute the shutdown command right after booting.

    I use a momentary switch with recalbox like the one on this page:
    https://github.com/recalbox/recalbox-os/wiki/Add-a-start-stop-button-to-your-recalbox-(EN)

    I would say, it is a normally open switch, as it is working (on recalbox) with this script:
    https://github.com/recalbox/recalbox-buildroot/blob/rb-4.1.X/board/recalbox/fsoverlay/recalbox/scripts/rpi-pin56-power.py#L22-L23

    Am I doing something wrong by making that change?

    ReplyDelete
    Replies
    1. Your new version solved the problem! Thank you very much!

      Delete
    2. Oh great :)

      I was just about to combine all my comments into one comment but then noticed your response!

      You should just need to use the default settings if using a push button between pin 5 & 6

      Delete
    3. You created a really useful addon there!

      Delete
    4. All thanks to your original question :)

      Delete

    5. It does not work with OpenELEC?

      Delete
    6. I've tested in LibreELEC.
      It may work in OpenELEC if they have the RPI.GPIO dependency available.

      Delete
    7. Thanks for the addon! Would be great if you could include a feature to monitor several GPIO-pins!

      Delete
    8. Good idea :)
      I'll add to the to-do list

      Delete

Post a Comment