Skip to main content

HyperHDR Ambient Lighting Python Package

Project description

hyperhdr-py

A Python library for controlling HyperHDR ambient lighting systems.

This library is a modified version of Dermot Duffy's excellent hyperion-py.

HyperHDR logo

Features

  • Full async support with asyncio
  • Connect to HyperHDR JSON API
  • Control colors, effects, components, and more
  • Subscribe to real-time state updates
  • Support for HyperHDR v19 through v22+
  • Websocket LED color/gradient streaming (optional; requires aiohttp)

New in v0.1.0 (HyperHDR v20-v22 support)

  • Average color calculation - Get the average color of current LED output
  • Smoothing control - Dynamically adjust smoothing parameters including new v22 interpolators
  • HDR tone mapping - Control HDR tone mapping mode including automatic detection (v21+)
  • Service discovery - Discover HyperHDR services on the network
  • Current LED colors - Get the current colors being sent to LEDs
  • Performance benchmarking - Run performance benchmarks
  • Config management - Save/load configuration database

Installation

pip install hyperhdr-py-sickkick

Quick Start

import asyncio
from hyperhdr import client, const

async def main():
    async with client.HyperHDRClient("hyperhdr.local") as hc:
        if hc:
            # Get brightness
            adjustment = hc.adjustment
            if adjustment:
                print(f"Brightness: {adjustment[0][const.KEY_BRIGHTNESS]}%")

            # Set a color
            await hc.async_set_color(color=[255, 0, 0], priority=50)

            # Set an effect
            await hc.async_set_effect(effect={"name": "Rainbow swirl"}, priority=50)

asyncio.run(main())

LED Streaming (WebSocket)

Install dependencies before using the stream helpers:

pip install aiohttp

If you enable convert_to_jpeg=True, install Pillow as well:

pip install Pillow

Or install the optional extras:

pip install "hyperhdr-py-sickkick[stream]"
pip install "hyperhdr-py-sickkick[stream-jpeg]"
import asyncio
from hyperhdr.stream import HyperHDRLedColorsStream, HyperHDRLedGradientStream

async def main():
    led_colors = HyperHDRLedColorsStream("hyperhdr.local", token="YOUR_TOKEN")
    await led_colors.start()
    frame = await led_colors.wait_for_frame()
    if frame and frame.raw:
        print("LED bytes:", len(frame.raw))
    await led_colors.stop()

    led_gradient = HyperHDRLedGradientStream("hyperhdr.local")
    async for frame in led_gradient.frames():
        print("Gradient update:", frame.source)
        break
    await led_gradient.stop()

asyncio.run(main())

See examples/stream_leds.py for a standalone script.

Thank you dermotduffy!

This library would not exist without the excellent work on hyperion-py.

Feel free to open an issue if you run into any problems!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperhdr_py_sickkick-0.2.0.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperhdr_py_sickkick-0.2.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file hyperhdr_py_sickkick-0.2.0.tar.gz.

File metadata

  • Download URL: hyperhdr_py_sickkick-0.2.0.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for hyperhdr_py_sickkick-0.2.0.tar.gz
Algorithm Hash digest
SHA256 de5ce6c5c15219fdd15f6165c6fc1a4ff1e1a17ed7fc4aa4ca9c19959775a239
MD5 2677ecbd0a453b08210a9fd8aab60e1f
BLAKE2b-256 1d3323ad15b8b13fb4e4efad0cdf1cb1133760d68716cc957b904b29780cb49b

See more details on using hashes here.

File details

Details for the file hyperhdr_py_sickkick-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hyperhdr_py_sickkick-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b709f17bd495d031cb9ad37e319fac695e7d2e175d5d40cc7d942f2ab479987
MD5 5150fac43a66d54a5a55558c3933ebf2
BLAKE2b-256 f76463b3e70d2bdb77426b85493a01e02ef82835292caf391913ed4ff3e96c18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page