Client module for the Hyperion JSON interface. You can also read this in Italiano๐ฎ๐น
Table of Contents (click to expand)
- An instance of Hyperion installed and configured (installation and configuration via HyperCon is suggested). You need to know the local IP address of the machine you installed Hyperion on
Open a terminal window and run the command:
pip install hyperion-client
NOT IMPLEMENTED YET!
In order to use this module you have to import it in your python project
import hyperion_client as hy
Create a new client by instantiating a new hyperion_client object
h = hy.hyperion_client()
If the machine running the client is different from the one running the Hyperion server, you have to specify the IP address of the machine running Hyperion. If you modified the default JSON interface port of your Hyperion instance, you can specify it here
h = hy.hyperion_client('192.168.1.42', 19444)
Connect to the Hyperion server
h.open_connection()
You can also modify the timout duration of the connection attempt (by default: 10ms)
h.open_connection(timeout=10)
if you try to interact with the server without opening a connection first, the functions of this module will try to connect automatically.
Disconnect from the Hyperion server
h.close_connection()
Change the IP address of the Hyperion server you want to connect to
h.host = '192.168.1.42'
When you change the host you need to reconnect. Get the IP address of the Hyperion server you want to connect to
my_host = h.host()
Change the port of the Hyperion server you want to connect to
h.port = 19444
When you change the port you need to reconnect. Get the port of the Hyperion server you want to connect to
my_port = h.port()
retrive all the usefull information form the Hyperion server, formatted in JSON (e.g.: active effects, active color, active color transforms, available effects, etc...)
my_server_info = h.serverinfo()
retrive the list of all the available effects info form the Hyperion server, formatted in JSON (e.g.: effect name, effect script path, effect args)
my_effects = h.effects()
retrive the list of all the available effects names form the Hyperion server
my_effects_names = h.effects_names()
retrive the list of all the active effects info form the Hyperion server, formatted in JSON (e.g.: effect name, effect script path, effect args)
my_active_effects = h.active_effects()
retrive the list of all the active effects names form the Hyperion server
my_active_effects_names = h.active_effects_names()
retrive a list containing the RGB, HEX, HLS values of the active color form the Hyperion server
my_active_color = h.active_color()
You can specify one of the modes (RGB/HEX/HLS) to get only corresponding value
my_RGB_color = h.active_color("RGB")
There are also functions to get:
- adjustment()
- correction()
- temperature()
- transform()
- priorities()
- hostname()
- hyperion_build()
Tell Hyperion to display a solid color passing RED, GREEN and BLUE values [0-255]
h.set_RGBcolor(255, 255, 255)
You can change the priority channel for the color using the priority param (default: 100). You can also change the duration, in milliseconds (default: infinite)
h.set_RGBcolor(red=255, green=255, blue=255, priority=100, duration=1000)
Tell Hyperion to display an effect
h.set_effect('Rainbow swirl fast')
You can change the priority channel for the effect using the priority param (default: 100). You can also change the duration, in milliseconds (default: infinite) and you can pass custom effect arguments in JSON format
h.set_effect('Rainbow swirl fast', priority=100, effectArgs=my_args, duration=1000)
Clear the highest priority active effect/color (with lower priority value)
h.clear()
You can change the priority channel for the color/effect to clear using the priority param (default: 100)
h.clear(100)
Clear all the active effects/color
h.clear_all()
Send a bytearray of the led data (r,g,b) * number of leds (aka hyperion.ledcount)
h.send_led_data(my_led_data)
You can change the priority channel for the custom data using the priority param (default: 100). You can also change the duration, in milliseconds (default: infinite)
h.send_led_data(my_led_data, 100, 1000)
There are also functions to set:
- set_image(image_data, width, height, priority=100, duration=0)
- set_adjustment(identifier, redAdjust, greenAdjust, blueAdjust)
- set_correction(identifier, red, green, blue)
- set_temperature(identifier, red, green, blue)
- set_transform(identifier, blacklevel, gamma, luminanceGain, luminanceMinimum, saturationGain, saturationLGain, threshold, valueGain, whitelevel)
Hyperion-controller uses this module
Please see CONTRIBUTING.md.
- 16/08/2018 - 0.1.0 - beta release