Skip to content

JFtechOfficial/hyperion-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

39 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Hyperion Client

PRs Welcome license GitHub issues GitHub code size in bytes GitHub top language

Client module for the Hyperion JSON interface. You can also read this in Italiano๐Ÿ‡ฎ๐Ÿ‡น

๐Ÿš€ Getting started

Table of Contents (click to expand)

Requirements

  • 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

๐Ÿ’พ Installation

Open a terminal window and run the command:

pip install hyperion-client

NOT IMPLEMENTED YET!

โ–ถ๏ธ Usage

In order to use this module you have to import it in your python project

import hyperion_client as hy

New client

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

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

Disconnect from the Hyperion server

h.close_connection()

host

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()

port

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()

Get server info

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()

Get effects info

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()

Get effects name

retrive the list of all the available effects names form the Hyperion server

my_effects_names = h.effects_names()

Get active effects info

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()

Get active effects name

retrive the list of all the active effects names form the Hyperion server

my_active_effects_names = h.active_effects_names()

Get active color

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")

Get other stuff

There are also functions to get:

  • adjustment()
  • correction()
  • temperature()
  • transform()
  • priorities()
  • hostname()
  • hyperion_build()

Set solid color

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)

Set effect

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

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

Clear all the active effects/color

h.clear_all()

Send custom data

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)

Set other stuff

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)

๐Ÿ“š Resources

Hyperion-controller uses this module

๐ŸŽ Contributing

Please see CONTRIBUTING.md.

โค๏ธ Credits

๐Ÿ’ต Support Me!

ko-fi

๐Ÿ—“๏ธ Release History

  • 16/08/2018 - 0.1.0 - beta release

๐ŸŽ“ License

MIT

About

Module for Hyperion JSON interface, written in Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages