GPIO Monitor Kodi Add-on

Features

  • Monitor multiple GPIO buttons on your Raspberry Pi
  • Run KODI function(s) when that button is pressed, released or held
  • Easily configure held time, bounce time, pull-up, hold repeat
  • Supports LibreELEC / OSMC / XBian / Raspbian on all Raspberry Pi boards

Need

How

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

Navigate to "Main Menu -> Add-ons -> My Add-ons"
Select ".." then select "Install from repository"
Select "MattHuisman.nz Repository".
Select "Program add-ons" then "GPIO Monitor"
Select "Install" and the add-on will download and install.
You can now access the add-on under Program add-ons.
The first time you run the add-on, you will need to install the service and then reboot.

Setup

After the reboot, you can now setup your buttons.
The add-on uses BCM board pin numbering (GPIO2 to GPIO27)
Click Add Button and then select the GPIO (BCM) Pin number.
Once the button is added, you can select it to edit it.
Follow the same process for any additional buttons.
The service status will be shown next to the button so you can easily see any errors.
eg. Below I have set Pull-up to False on GPIO3 which has an built-in physical pull-up.
You can delete buttons using the context menu.

Functions

The full list of KODI functions can be found HERE.
Below are some commonly used functions.
  • Reboot
  • Shutdown
  • Action(Up)
  • Action(Down)
  • Action(Left)
  • Action(Right)
  • Action(Select)
  • Action(Back)
  • ActivateWindow(window_id)
  • CECStandby
  • RunPlugin(plugin_id)
  • RunAddon(addon_id)
Multiple functions can be separated with a (pipe).
They will run in order. eg. Action(Up)|Action(Up)|Reboot.
That will move up twice and then reboot.

Example

Here is an example setup for a basic Reboot GPIO button.
It uses GPIO17 with a button that pulls the pin low (GND).

Set Output Pin State

The add-on also has a path that allows setting the state of an output pin.
The url for this is plugin://service.gpio.monitor/?_=set_state&pin={PIN}&state={STATE}
{PIN} is a number from 2-27 (corresponding to the above BCM pin nubers).
{STATE} can be 0 for low or 1 for high.

This allows you to use other plugins to control the state of the GPIO Pins.
eg. Use Kodi Callbacks add-on to set GPIO pin 3 low when Playback starts.
You would use the "builtin" task and set the built-in function to
RunPlugin(plugin://service.gpio.monitor/?_=set_state&pin=3&state=0)

Next

Discussion

Support

Check out the Supporter Perks

Follow