I have received a great deal of valuable info here and I hope this post could be a small useful tip to anyone here.
This is to show you my way of controlling the hyperion with remote controller. I am sure there are lots of smarter ways to do this.
My set up is RPI3 and OSMC KODI. My remote controller can be found in the following link:
This remote is inexpensive and it works fine with KODI. However, some of the keys in this remote have no use in KODI. So I used them to control the hyperion.
BTW, if you are using a USB keyboard to control KODI, I belive this method will work as well. All you need to know is the your control device's KEY ID.
OK here we go...
1. SSH into your OSMC and build python files to execute the hyperion control command. I named the files hyp-off.py and hyp-on.py and I put them in the following folder.
/home/osmc/hypctl/
2. hyp-off.py contains the following code:
#! /usr/bin/python
import os
os.system("/usr/bin/hyperion-remote --color black")
os.system("sleep 2")
os.system("sudo systemctl stop hyperion")
3. hyp-on.py contains the following code:
4. Make the above two newly created files executable with the following commands:
chmod u+x /home/osmc/hypctl/hyp-off.py
chmod u+x /home/osmc/hypctl/hyp-on.py
5. Create keyboard.xml in the following location:
/home/osmc/.kodi/userdata/keymaps
6. Here you will need to know your remote's key id. For my case, I am using the "desktop" (key ID 2158660) in the bottom right corner to turn off Hyperion and the key "My PC" (key ID 2158661) to turn on Hyperion.
The code of keyboard.xml is as the following:
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<keyboard>
<key id='2158660'>RunScript(/home/osmc/hypctl/hyp-off.py)</key>
<key id='2158661'>RunScript(/home/osmc/hypctl/hyp-on.py)</key>
</keyboard>
</global>
</keymap>
Alles anzeigen
8. Restart your kodi with the following command and we are done
sudo systemctl restart mediacenter
Actually, with this method, you can customize your remote and let it activate/deactivate all hyperion command such as turn on/off the built-in hyperion effects, or light up the leds with the color you want etc. All you have to do is put the hyperion-remote command in the python file and map your key to execute the python file.
Hope this helps and I know there is better way to do this. Hope you could let me know if you have any better idea. Or if there is any problem with the method I introduced here, please let me know too! Thank you!!!