Kodi, Harmony, and Raspberry PI 4 with IR sensor newb guide

  • Verified working with 10.0.1


    After 6 years of using cheap boxes I decided to explore other hardware options. I was shocked at the price of Shields and some higher end boxes based on Amlogic S922X chips. After some pondering I ended up getting a Raspberry Pi 4 for it's price to power ratio. I realize that it may not be better or even equivalent to the aforementioned solutions, but it certainly beats my limping 905X based boxes.

    Using a RPI4 is definitely not for the plug and play hardware crowd but it is not that hard either, until you get to the IR part. There is no easy solution other than Flirc. Unfortunately your IR sensor is in the back, and even more insulting, it costs 1/2 the price of the PI4 itself! I also looked at using CEC which can be a good solution for people using their TV remote, but one of my main requirements was a solid universal remote.

    I have a rather complex audio setup and I value simplicity above all else, which is why I insist on an affordable, durable, and easy to use remote like the Harmony 650. To me the 650 is the ideal remote and more importantly, it's survived about 8 years so far, which is a testament to its great design. As a dyed in the wool gadgeteer, I originally bought their more expensive model but my family managed to break the screen within 3 months. And let's face it, how often do you really need a touch screen?

    After struggling with outdated and spread out information I was fortunate enough to get help from ghtester and HiassofT to configure my install. This guide is my attempt to pay it forward.

    Please note:

    • This guide does not try to explain the why of the subject, rather the how which is why I cannot give support. Please direct your questions to the forum experts.
    • I put this together from a few sources so I may have mis-remembered a few things. Please do the forum a favour and let me know if I need to change, correct, or amend this guide.

    Hardware Used

    1. Raspberry Pi 4B 2GB
    2. RPI4 enclosure that allows infrared signals to pass through the front. I am partial to this one but you do need to carefully align the sensor.It's pretty cool looking and includes the power supply, fan, and heatsinks fro $21 CAD. Pretty good deal if you ask me.
    3. TSOP38238 IR receiver - Installed on GPIO 18 as per this article.
    4. Harmony 650

    Files needed

    1. LibreELEC USB-SD Creator app
    2. mecool rc_keymap in the files.zip file attached to this post
    3. rc_maps.cfg in the files.zip file attached to this post


    1. Install the IR TSOP as per this guide. It's very easy, only 1 component and 3 wires. Do not install in an enclosure until you confirm proper operation.
    2. Install the Mecool KIII Pro device on your remote using the Harmony software.
    3. Downloaded the LibreELEC USB-SD Creator and use it to select the latest LE RPI4 image and burn it to an SD card.
    4. Plug in a USB mouse. A keyboard, while not strictly necessary may be useful to ease text entry.
    5. Put the SD card in your RPI4 and boot. Kodi's wizard will walk you through the initial setup:
      1. Enable SSH
      2. Change the default name from Libreelec to whatever you want, or leave as is
      3. Configure your network
      4. Set wait for network before booting. I set a 20 second maximum wait time use whatever works for you
      5. Disable CEC in Kodi: System -> Settings -> Input -> Peripherals -> CEC Adapter -> Disable
      6. Reboot to make sure it reconnects to your network with the proper name, default is Libreelec.
    6. In OS X Finder, you should see Network under the locations section in the left panel.
    7. Click on it and then on Libreelec, or whatever name you used when you initially set up Kodi. It will now appear in the side panel of connected network devices.
    8. Open the Configfiles folder and drag in the rc_maps.cfg file attached to this post. Please note that many guides will walk you through terminal to do this. Fortunately, some very forward thinking developer designed it so that the normally hidden .config directory is automatically mounted as Configfiles, making it much easier to accomplish these tasks from a computer.
    9. Open the rc_keymaps folder and drag in the mecool file attached to this post.
    10. Now we need to ssh into the RPI4. Open Terminal in OS X or Putty in Windows:
      1. Connect to the RPI4 by entering: ssh root@libreelec (or ssh root@nameyougaveit)
      2. When prompted for password, enter it. The default is: libreelec
      3. We need to remount the /flash directory as read/write to modify a file: mount -o remount,rw /flash
      4. We now need to edit the file using the built in text editor, Nano: nano /flash/config.txt
      5. Add the following text to config.text. just above the End of Default Configuration text. (pin # = pin you used, default is 18 for most people 23 is for Argon One). dtoverlay=gpio-ir,gpio_pin=18Save changes with CTRL O
      6. Exit nano with CTRL X
      7. To finish, remount /flash as read only: mount -o remount,r /flash
    11. After making any changes to the rc_maps file you need to make it permanent. Enter the following:
      1. systemctl stop kodi (The system may seem like it crashed but be patient, it can take almost a minute)
      2. systemctl stop eventlircd
      3. ir-keytable -a /storage/.config/rc_maps.cfg -s rc0
      4. systemctl start eventlircd
      5. systemctl start kodi
      6. Reboot to apply changes: reboot
    1. When rebooted, ssh back into the box to test your work:
      1. ssh root@libreelec (or ssh root@nameyougaveit)
      2. Enter: irw
      3. Push the buttons on your remote to test. Each button should be properly labeled. If you need to remap buttons, do it in the Harmony software to avoid complications.
      4. Use CTRL C to exit the testing routine
    2. Close your ssh session with exit and open your beverage of choice!

    Let me know if I need to make changes to the guide.

  • Ran into an error while following your guide:

    • At the ir-keytable -a /storage/.config/rc_maps.cfg -s rc0 command, the rapsberry replied :
      • "sys/class/rc/: No such file or directory No devices found"

    Am I missing something? I tried following your guide as precisely as possible, with the exceptions that I am using WinScp and putty as interfaces to connect to the raspberry Pi and that my GPIO mapping is set to 23 instead of 18 (Using an Argon ONE M.2 case with integrated IR receiver).

    Scratch that, it worked the second time I tried to run the command. Not sure why it refused to work the first time around though.

    Edited once, last by bluewolf10th (January 31, 2021 at 6:01 PM).

  • I should have mentioned that the GPIO pin is 23, not 18 so fix that first in your config.

    You don’t need to follow my guide by the way, but you can use the key table file if you want to use a harmony.

    I think all you need to do is install Raspberry Pi tools and system tools (I think that’s the file) from Libreelec repo. Then you use the Argon one script. I will amend my guide to include the argon one but not sure when I will have time.

    I will try and respond tomorrow with a better post when I get all the info together.

  • Had already tweaked the config to us GPIO 23 and have the argon script along with Raspberry Pi tools and system tools installed. Will keep experimenting and see if I can find a way forward.

    Am using a nightly build so that might be part of the issue.

  • I'm so excited to see this thread, and very grateful you've taken the time to do this so thoroughly. :cool: I've begun the journey -- but haven't been totally successful as of yet. My setup:

    - Pi 4B

    - Argon One V2 case with built-in IR

    - Logitech Harmony Elite with Hub

    I'm determined to get this to work! I seem to be stuck trying to figure out how to properly load the Argon IR config scripts (I was able to load them all with no problem, on mOOde, but am having difficulties with Libreelec). Hopefully I can work on this more tonight.


    Quote from PANiCnz "I'm also getting the error message "No devices found" when running the ir-keytable -a /storage/.config/rc_maps.cfg -s rc0 any ideas why?"

    I ran into this problem... I'm using Windows and when I copied rc_maps.cfg (using XYplorer, not Windows Explorer) to \\libreelec\Configfiles\ -- without my realization, the filename changed to rc_maps.cfg.sample ... After catching this and renaming the file, the error stopped.

    Edited once, last by Grace2U (March 3, 2021 at 3:37 PM).

  • For what its worth, managed to adapt the above instructions to use a standard MCE remote. Just follow the instructions in the LE wiki, in particular the "Configuration (Easy)" section.

  • After each reboot I have to re-enter the "ir-keytable -a /storage/.config/rc_maps.cfg -s rc0" command for the remote control to work.

    Is it not possible to make this fixed?

    Media-Wohnzimmer:~ # ir-keytable -a /storage/.config/rc_maps.cfg -s rc0
    Old keytable cleared
    Wrote 34 keycode(s) to driver
  • I want to wrap this up now.

    These instructions work perfectly with Libreelec 10.0

    With Libreelec 9.2.8 the command "ir-keytable -a /storage/.config/rc_maps.cfg -s rc0" is lost with every restart.

  • I'm also getting the error message "No devices found" when running the ir-keytable -a /storage/.config/rc_maps.cfg -s rc0 any ideas why?

    I had the same error in line

    3. ir-keytable -a /storage/.config/rc_maps.cfg -s rc0

    For that reason I rebooted the raspi after copying the mecool file and startetd at Item

    1. systemctl stop kodi (The system may seem like it crashed but be patient, it can take almost a minute)
    2. .....

    Then it works fine. Thanks for the very good description.

  • hello

    people who have this working with Argon One V2 can you power on the Pi using your harmony remote?

    i can get it to control but not power on. The script from Argon One does not work for IR setup for powering on.

    I get error when pressing 1