Spezzer Posted June 29, 2016 Report Share Posted June 29, 2016 HiI 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 Quote Link to comment Share on other sites More sharing options...
yawor Posted July 1, 2016 Report Share Posted July 1, 2016 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/bashor even better#!/usr/bin/env /bin/bash Quote Link to comment Share on other sites More sharing options...
Spezzer Posted July 2, 2016 Author Report Share Posted July 2, 2016 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 Quote Link to comment Share on other sites More sharing options...
yawor Posted July 2, 2016 Report Share Posted July 2, 2016 (edited) 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 July 2, 2016 by yawor Quote Link to comment Share on other sites More sharing options...
Spezzer Posted July 2, 2016 Author Report Share Posted July 2, 2016 Thanks that looks really useful - I've sent a comment and couple of questions.Think I'll try OSMC on another card and see how that looks as well.cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.