Directories | |
| adapters | |
| parsers | |
The controllers.lighting package provides application-agnostic interfaces, state models, test doubles, and hardware adapters for lighting devices.
A silent deterministic implementation of LightingControllerIf.
Use it when a consumer requires a lighting controller but the test does not care about lighting behavior. Commands immediately return successful completed futures and do not mutate state.
A stateful in-memory emulator.
Use it for UI development, component tests, and demonstrations where callers need to inspect LightingState after commands are issued.
The hardware adapter for LEDDMX-compatible Bluetooth Low Energy controllers. It owns a background asyncio event loop and exposes thread-friendly concurrent.futures.Future objects to synchronous callers such as Tkinter.
Install Bleak:
Bleak is the Bluetooth Low Energy GATT client used by the LEDDMX adapter.
Bleak's Linux backend communicates with BlueZ over D-Bus. Install BlueZ and ensure the Bluetooth service is running.
Debian, Ubuntu, and Raspberry Pi OS:
Confirm the adapter is visible:
The current Bleak documentation requires a Linux distribution with BlueZ 5.55 or newer.
The BLE service UUID, write characteristic UUID, discovery exclusions, and timing options are stored in:
Example:
Load it explicitly:
When address is omitted, the adapter scans nearby BLE devices and checks for the configured write characteristic.
The protocol and configuration parser should also have independent tests as the package grows.
lighting.bluetooth records command execution, connection transitions, write retry and recovery; lighting.ui retains request IDs through futures and UI completion callbacks. lighting.reactive records enable changes and output failures/recovery while routine music-driven commands stay DEBUG. An unconfigured backend reports a fixed availability state. Records exclude discovery names, BLE addresses/UUIDs, packets, RGB/brightness values and exception messages. Existing BLE retry timing is preserved. See the device validation guide.