|
2 | 2 |
|
3 | 3 | Async Python client for the **Philips Hue Entertainment** streaming API. |
4 | 4 |
|
5 | | -A small, dependency-light library that pairs with a Hue bridge, discovers entertainment |
6 | | -areas, and streams color frames to the lights over **DTLS 1.2 PSK** using the `HueStream` |
7 | | -protocol — with **as little latency as possible**. Works with both the Hue **V2** |
8 | | -("square") bridge and the new Hue **Pro** bridge. |
| 5 | +It pairs with a Hue bridge, discovers entertainment areas, and streams colour frames to the |
| 6 | +lights over **DTLS 1.2 PSK** using the `HueStream` protocol with minimal latency. It works |
| 7 | +with both the Hue **V2** ("square") bridge and the Hue **Pro** bridge. |
9 | 8 |
|
10 | | -The DTLS handshake and record layer are implemented in pure Python on top of |
| 9 | +The DTLS 1.2 PSK handshake, record layer and HueStream encoder are pure Python on top of |
11 | 10 | [`cryptography`](https://cryptography.io/) — no `openssl` subprocess, no C bindings, no |
12 | | -other DTLS dependency. Blocking socket I/O is confined to a dedicated sender thread so it |
| 11 | +other DTLS dependency. Blocking socket I/O is confined to a dedicated sender thread, so it |
13 | 12 | never blocks your asyncio event loop. |
14 | 13 |
|
15 | | -> Extracted from [Music Assistant](https://github.com/music-assistant/server)'s |
16 | | -> `hue_entertainment` provider so it can be shared across projects (e.g. Music Assistant |
17 | | -> and [ambilight-hue-pro-bridge](https://github.com/marcelveldt/ambilight-hue-pro-bridge)). |
| 14 | +It powers the Hue Entertainment plugin (the Sendspin bridge) in |
| 15 | +[Music Assistant](https://github.com/music-assistant/server) and the |
| 16 | +[ambilight-hue-pro-bridge](https://github.com/marcelveldt/ambilight-hue-pro-bridge). |
18 | 17 |
|
19 | | -## Status |
| 18 | +## What it provides |
20 | 19 |
|
21 | | -Early standalone release. The core (pairing, area discovery, DTLS streaming, HueStream v2 |
22 | | -encoding) is the same code that is *"working and tested on Hue Bridge V2 and Hue Bridge |
23 | | -Pro"* in Music Assistant. The async `EntertainmentSession` lifecycle wrapper is new. |
| 20 | +- **Pairing** — create an application key and the DTLS client key (`HueEntertainmentAPI.pair`). |
| 21 | +- **Discovery** — list a bridge's entertainment configurations with their channels and positions. |
| 22 | +- **Streaming** — start/stop an entertainment stream and push per-channel colours at up to ~50 Hz. |
| 23 | +- **`EntertainmentSession`** — a high-level async facade that opens the stream on demand, runs |
| 24 | + the blocking DTLS work in an executor, enforces the bridge's single-active-stream constraint, |
| 25 | + and tears the stream down after inactivity. |
| 26 | +- Works with the V2 and Pro bridges, with `aiohttp` + `cryptography` as the only dependencies. |
| 27 | + |
| 28 | +## What you can build with it |
| 29 | + |
| 30 | +Anything that drives Hue lights from a fast colour source — screen / Ambilight sync, music |
| 31 | +visualisers, games, rich notifications, or your own virtual bridge — without the Hue Sync |
| 32 | +hardware. |
| 33 | + |
| 34 | +## Planned extensions |
| 35 | + |
| 36 | +- HueStream **v1** framing and the **CIE xy** colour space (currently HueStream v2 / RGB). |
| 37 | +- mDNS-based bridge discovery helpers. |
24 | 38 |
|
25 | 39 | ## Install |
26 | 40 |
|
|
0 commit comments