-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathHyperionConfigTester.py
More file actions
40 lines (33 loc) · 1.3 KB
/
HyperionConfigTester.py
File metadata and controls
40 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from json_client import JsonClient
import subprocess
import os
class HyperionConfigTester:
connection = None
hyperion_path = ""
config_folder = ""
led_chain = None
def __init__(self, chain = None):
self.led_chain = chain
if os.uname()[1] == "OpenELEC":
self.hyperion_path = "/storage/hyperion/bin/hyperiond.sh"
self.config_folder = "/storage/.config/"
else: #not tested
self.hyperion_path = "hyperiond"
self.config_folder = "/etc/"
def restart_hyperion(self,config_file_name):
subprocess.call(["killall", "hyperiond"])
subprocess.Popen([self.hyperion_path, self.config_folder+config_file_name])
def connect_to_hyperion(self):
"""Connects to local hyperion"""
self.connection = JsonClient('127.0.0.1', 19444, timeout=10)
self.connection.connect()
def mark_corners(self):
self.led_chain.leds[self.led_chain.nol_vertical].set_color(255,0,0)
self.led_chain.leds[self.led_chain.nol_vertical+self.led_chain.nol_horizontal].set_color(0,255,0)
self.led_chain.leds[(self.led_chain.nol_vertical*2)+self.led_chain.nol_horizontal].set_color(0,0,255)
def change_colors(self):
self.connection.send_led_data(self.led_chain.leds_to_bytearray())
def set_single_color(self, red, green, blue):
self.led_chain.set_single_color(red, green, blue)
def disconnect(self):
self.connection.disconnect()