1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Installation on OSMC

Viewing Revision
This is an old revision of this page, as edited 7 April 2016, 00:07 by Brindosch. It may differ significantly from the current revision.
Introduction

Instructions in the next chapters will show how to install Hyperion on a generic Linux system, for other specific OS flavors:

Installation

If you use direct connected PWM LEDs (WS281X): Just use the install script with the following command:
Note: There is some weird behaviour with pwm leds and osmc we DON´t recommend to use it! We can´t fix it!

Code:
wget -nv -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh && chmod +x install_hyperion.sh
sudo sh ./install_hyperion.sh WS281X
If you use direct connected SPI LEDs (WS2801, APA102, LPDXXXX, ...): Just use the install script with the following command:

Code:
wget -nv -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh && chmod +x install_hyperion.sh
sudo sh ./install_hyperion.sh
If you use USB connected devices (Arduino, ...): Just use the install script with the following command:

Code:
wget -nv -N https://raw.github.com/tvdzwan/hyperion/master/bin/install_hyperion.sh && chmod +x install_hyperion.sh
sudo sh ./install_hyperion.sh USB
If you see no "critical error" message, all went good.
Now you need your own created configuration file that depends on your led hardware/setup. Follow the HyperCon Tutorial for this.


Exta buttons on remote to control lights / change static colour

We need some dependencies for this to work. Type this at the command line
Code:
apt-get install psmisc
  • After that we copy the colourswitch.py, off.py and switch.py to /home/osmc/hyperion.
off.py source (one button on my Harmony Remote to kill all lights in the house, including the Hyperion deamon):

Code:
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
[CODE]

switch.py source (to turn ambilights on/off and off/on with single button**
[CODE]
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 source (to get different colours while pusing the same button over and over)**

Code:
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:
Code:
<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**