Hyperion Install Guide on OSMC tested on RC3

Install Hyperion on OSMC

First we need to install some packages

sudo apt-get update && apt-get dist-upgrade && apt-get install git libqtcore4 libqtgui4 libqt4-network libusb-1.0-0 libprotobuf9 ca-certificates

Download Hyperion:

wget -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh

This may fail when your systemtime is not correct! check time with:

date

Now install hyperion

sh ./install_hyperion.sh

Put hyperion.config.json in /etc

Enable GPIO’s:

vi /boot/config.txt
add the next line
dtparam=spi=on

This should work, now if you want extra button continue reading.

\

\

Exta buttons on remote to control lights / change static colour

Make OSMC user boot hyperion instead of sudo/root user

Basic explaination:

Hyperion installer doesnt handle OSMC correctly yet so this is a manual must if you want extra button on the remote to control youre ambilight.
Now everytime we boot it automaticly boots as sudo/root user, we dont want that otherwise we cannot use our colourswitch and on/off button button. This is cause the privilleges limitation on the default OSMC user when we let it open automaticly as sudo/root.

Now we need killall for some scripts im using

apt-get install psmisc

We remove the hyperion symoblic link at

/etc/init.d

Next we create hyperion.service file and put that in /etc/systemd/system (this wil open hyperion as OSMC user every boot) (below the content of hyperion.service)

[Unit]
Description=Hyperion
[Service]
Type=simple
User=osmc
Group=osmc
UMask=007
ExecStart=/opt/hyperion/bin/hyperiond /etc/hyperion.config.json
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
TimeoutStopSec=10
 
[Install]
WantedBy=multi-user.target

Then we need to start the service in ssh, once

/opt/hyperion/bin/hyperiond /etc/hyperion.config.json

Then we create a new symbolic link

sudo systemctl enable hyperion

After that we copy the colourswitch.py, off.py and switch.py to /home/osmc/hyperion

off.py (one button on my Harmony Remote to kill all lights in the house, including the Hyperion deamon)

import subprocess

pid = subprocess.Popen('pidof hyperiond', shell=True, close_fds=True, stdout=subprocess.PIPE)

try:
    if pid.stdout.readlines():
        subprocess.Popen('killall hyperiond', shell=True)
    else:
        subprocess.Popen('killall hyperiond', shell=True)
except Exception, e:
    pass

switch.py (to turn ambilights on/off and off/on with single button

import subprocess

pid = subprocess.Popen('pidof hyperiond', shell=True, close_fds=True, stdout=subprocess.PIPE)

try:
    if pid.stdout.readlines():
        subprocess.Popen('killall hyperiond', shell=True)
    else:
        subprocess.Popen('/opt/hyperion/bin/hyperiond /etc/hyperion.config.json </dev/null >/dev/null 2>&1 &', shell=True)
except Exception, e:
    pass

colourswitch.py (to get different colours while pusing the same button over and over)

Created on Mar 27, 2015

@author: lukas, nobcat
'''

import json
import subprocess

colors = ['purple',
          'blue',
          'yellow',
          ]

defaultData = {"color":"purple",
               "effect":"night rider"
               }

def read_current():
    try:
        with open('/home/osmc/hyperion/current.json', 'r') as f:
            data = json.load(f)
        f.close()
        if data == '':
            return defaultData
        else:
            return data
    except (IOError, ValueError):
        return defaultData
    
def write_current(data):
    try:
        with open('/home/osmc/hyperion/current.json', 'w') as f:
            json.dump(data, f)
        f.close()
    except IOError:
        pass
    
def parse_current_effect():
    pass

def set_current_effect():
    pass

def set_color(color):
    subprocess.Popen('/opt/hyperion/bin/hyperion-remote --priority 100 --color ' + color, shell=True)

def main():
    current_data = read_current()
    for i,color in enumerate(colors):
        if color == current_data['color']:
            if i == len(colors) - 1:
                current_data['color'] = colors[0]
                break
            else:
                current_data['color'] = colors[i + 1]
                break
        
    write_current(current_data)
    set_color(current_data['color'])
    
main()

Last we define the buttons in remote.xml

<yellow>RunScript("/home/osmc/hyperion/colourswitch.py")</yellow>
<blue>RunScript("/home/osmc/hyperion/switch.py")</blue>
<red>RunScript("/home/osmc/hyperion/off.py")</red>

And put remote.xml on /home/osmc/.kodi/userdata/keymaps

Done!
1 Like

Hi, this is somehow set, for example by using a script to Hyperion did not start when you turn on KODI but when, for example, a remote command or cron command?
RaspBMC worked on this script:

## Hyperion daemon

description "hyperion"
author "poljvd & tvdzwan"

stop on (runlevel [!2345])

respawn

pre-start script
modprobe spidev 
/usr/bin/gpio2spi
end script

exec /usr/bin/hyperiond /etc/hyperion.config.json

Then:

#!/bin/bash
 
if [ `sudo /sbin/initctl status hyperion | grep running | wc -l` = 1 ]
then
    curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hyperion","message":"Disabled","image":"/home/pi/hyperion.png"}}' http://127.0.0.1:8080/jsonrpc
    sudo /sbin/initctl stop hyperion
 
else
    curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hyperion","message":"Enabled","image":"/home/pi/hyperion.png"}}' http://127.0.0.1:8080/jsonrpc
    sudo /sbin/initctl start hyperion
fi

That’s the way I drove switching Hyperion remote control or cron. It works something like this on OSMC?

TO be honest i dont know, i have this script on a button and that connection to my harmony remote, when i press blue it goes on and off, when i hold blue (connected to yellow) it changes the static colour, good hack!

Hey there,
I have an issue when installing Hyperion. I get the error “Failed to start hyperion.service: Access denied” full install is listed below

osmc@Ulrich:~$ sh ./install_hyperion.sh
Failed to stop hyperion.service: Access denied
Downloading hyperion
converted ‘https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hype rion.tar.gz’ (ANSI_X3.4-1968) → ‘https://raw.githubusercontent.com/tvdzwan/hype rion/master/deploy/hyperion.tar.gz’ (UTF-8)
–2016-01-30 21:42:13-- https://raw.githubusercontent.com/tvdzwan/hyperion/mast er/deploy/hyperion.tar.gz
Resolving raw.githubusercontent.com (raw.githubusercontent.com)… 103.245.222.1 33
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222. 133|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 7766671 (7.4M) [application/octet-stream]
Saving to: ‘STDOUT’

  •                 0%[                      ]  39.27K  44.1KB/s             t                  ar: hyperion: Cannot mkdir: Permission denied
    
  •                62%[============>         ]   4.59M   231KB/s   eta 30s   t                  ar: hyperion/bin/hyperiond: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied

  •                68%[=============>        ]   5.05M   291KB/s   eta 20s   t                  ar: hyperion/bin/hyperion-remote: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied

  •                97%[====================> ]   7.22M   206KB/s   eta 2s    t                  ar: hyperion/bin/hyperion-v4l2: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/bin/gpio2spi: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied

  •               100%[=====================>]   7.41M   225KB/s   in 54s
    

2016-01-30 21:43:12 (142 KB/s) - written to stdout [7766671/7766671]

tar: hyperion/bin/dispmanx2png: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/knight-rider.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/knight-rider.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-blue.json: Cannot open: No such file or directo ry
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-cold.json: Cannot open: No such file or directo ry
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-full.json: Cannot open: No such file or directo ry
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-green.json: Cannot open: No such file or direct ory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-red.json: Cannot open: No such file or director y
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-warm.json: Cannot open: No such file or directo ry
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-mood.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-mood.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl-fast.json: Cannot open: No such file or dire ctory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/snake.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/snake.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-blue.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-raspbmc.json: Cannot open: No such file or director y
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-white.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/init.d/hyperion.init.sh: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/config/hyperion.config.json: Cannot open: No such file or director y
tar: Exiting with failure status due to previous errors
ln: failed to create symbolic link ‘/usr/bin/hyperiond’: Permission denied
ln: failed to create symbolic link ‘/usr/bin/hyperion-remote’: Permission denied
ln: failed to create symbolic link ‘/usr/bin/hyperion-v4l2’: Permission denied
ln: failed to create symbolic link ‘/etc/hyperion.config.json’: Permission denie d
Installing startup script in init.d
ln: failed to create symbolic link ‘/etc/init.d/hyperion’: Permission denied
chmod: cannot access ‘/etc/init.d/hyperion’: No such file or directory
update-rc.d: error: initscript does not exist: /etc/init.d/hyperion
Failed to start hyperion.service: Access denied
osmc@Ulrich:~$ sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] []
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] file …
osmc@Ulrich:~$ sh ./install_hyperion.sh
Failed to stop hyperion.service: Access denied
Downloading hyperion
converted ‘https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz’ (ANSI_X3.4-1968) → ‘https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz’ (UTF-8)
–2016-01-30 21:50:30-- https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz
Resolving raw.githubusercontent.com (raw.githubusercontent.com)… 103.245.222.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 7766671 (7.4M) [application/octet-stream]
Saving to: ‘STDOUT’

  •                      0%[                                   ]   8.00K  7.64KB/s             tar: hyperion: Cannot mkdir: Permission denied
    
  •                     62%[====================>              ]   4.60M  92.4KB/s   eta 31s   tar: hyperion/bin/hyperiond: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied

  •                     68%[======================>            ]   5.07M   104KB/s   eta 25s   tar: hyperion/bin/hyperion-remote: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied

  •                     98%[=================================> ]   7.27M   164KB/s   eta 1s    tar: hyperion/bin/hyperion-v4l2: Cannot open: No such file or directory
    

tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/bin/gpio2spi: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied

  •                    100%[==================================>]   7.41M   189KB/s   in 73s
    

2016-01-30 21:51:48 (104 KB/s) - written to stdout [7766671/7766671]

tar: hyperion/bin/dispmanx2png: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/knight-rider.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/knight-rider.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-blue.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-cold.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-full.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-green.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-red.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs-warm.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/mood-blobs.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-mood.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-mood.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl-fast.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/rainbow-swirl.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/snake.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/snake.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-blue.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-raspbmc.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe-white.json: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/effects/strobe.py: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/init.d/hyperion.init.sh: Cannot open: No such file or directory
tar: hyperion: Cannot mkdir: Permission denied
tar: hyperion/config/hyperion.config.json: Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors
ln: failed to create symbolic link ‘/usr/bin/hyperiond’: Permission denied
ln: failed to create symbolic link ‘/usr/bin/hyperion-remote’: Permission denied
ln: failed to create symbolic link ‘/usr/bin/hyperion-v4l2’: Permission denied
ln: failed to create symbolic link ‘/etc/hyperion.config.json’: Permission denied
Installing startup script in init.d
ln: failed to create symbolic link ‘/etc/init.d/hyperion’: Permission denied
chmod: cannot access ‘/etc/init.d/hyperion’: No such file or directory
update-rc.d: error: initscript does not exist: /etc/init.d/hyperion
Failed to start hyperion.service: Access denied

You need to run the install script with sudo.

Just a comment to bring this up to date.

I installed Hyperion for the first time today (I used to use Boblight back in the Raspbmc days) and was very impressed at how easy it was to install. I didn’t install it using the script like in the post above, instead I used the Java based installer from the Hyperion website.

Basically if you have an OSMC install with SSH enabled you can just follow the instructions here;
https://hyperion-project.org/wiki/Installation-on-all-systems

The beauty of doing it this way is that it’s all automated and there is no command line work involved at all. You point and click with a mouse on your main computer and then send the config over to your OSMC device. This should make it easy for non-techie people to set this up.

1 Like

and I have it working with Pimoroni Mote as the LED lights.
I did it by adapting some code that acts as a OPC (FadeCandy) server.
I forked that code and then created a “Mote” branch.
I hope to spend some more time on it in the future to make it a bit more generic and configurable - and then pass it back to the original author (if he is interested).

More info at GitHub - PaulWebster/artnet-unicorn-hat at mote

Note: the HyperCon method doesn’t seem to work for the Vero 4K, as of yet.
I get a critical error telling me that the CPU matches no known configuration.