Jump to content
Flirc Forums

Launch SH on Openelec with Harmony


Spezzer

Recommended Posts

Hi

I want to run a .sh script using my harmony remote. My set up is a Kodi Openelec media centre and Humax freesat box connected through an HDMI matrix to an LG tv and Optoma projector. Kodi is running on a RPi 3 with a USB Flirc. All is well and everything is (pretty much) under control. Now I want more!

Now I want to be able to run .sh scripts on the RPi 3 when I press a button on the remote. The reason for this is I've lifted some scripts from an old openremote2 install and can use the GPIO to activate a circuit on a RC remote that controls lights and projector screen. I've googled loads and got myself totally confused. I've read about flirc_util but have been unable to get this working on the openelec install.

Any pointers?

thanks

Link to comment
Share on other sites

Hi,

Flirc_util is not a way to go for sure. That's a configuration tool (like a Flirc GUI). You should record a remote button and map it to some key combination (not yet used for Kodi). To call a script, you need to somehow capture the key combination you've recorded and then act on it. There are probably multiple ways to do this, but given you're already using Kodi then you can add your own keyboard shortcuts by editing Kodi's keyboard.xml config file (you can find how to do that on Kodi's wiki pages - better do some reading before you start editing config files).

You probably want a like similar to this in your keyboard.xml file:

<A mod="ctrl,alt">System.Exec("/path/to/a/script.sh")</A>

This will execute the /path/to/a/script.sh when ctrl+alt+a is pressed. Of course the script needs to have executable flag set and a proper hashbang at the beginning:

#!/bin/bash

or even better

#!/usr/bin/env /bin/bash

 

Link to comment
Share on other sites

Thanks for the pointers - makes sense.

The script I want to run is a WiringPi script but cannot install on Kodi install. This is bit of a showstopper. WiringPi enables me to use the GPIO command and operate an 8-way relay connected to an RC remote. So need to figure how to run a GPIO.sh command on Kodi. Its probably a bit off-track as far as flirc forum is concerned but there seems to be a bit out there on the subject.

cheers

Link to comment
Share on other sites

If you know Python you could write a script which would be run directly from Kodi.

http://www.barryhubbard.com/raspberry-pi/howto-raspberry-pi-openelec-power-wake-shutdown-button-using-gpio/

You can start by reading this article. It shows how to install GPIO support library for Kodi which enables you to write Python scripts for Kodi which can use GPIO pins.

You can also try switching to OSMC. It uses the Raspbian as a base system and the root file system is writable. You can install what you need using standard apt-get command. I'm using OSMC on my RPi2 for a long time now and it works perfectly.

Edited by yawor
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...