Stream Deck Office Controller
A 15-key desk controller for lights and Sonos, with the layout generated from code and live album art on the play button.
An Elgato Stream Deck driven by Bitfocus Companion on a Raspberry Pi becomes a physical control surface for the office: one row of lighting, one row of Sonos transport, and five one-touch playlists. Rather than clicking fifteen buttons together in Companion's web UI and losing the work on every rebuild, the layout is defined as code and written straight into Companion's database.
The design
Every light and media action exists as a Home Assistant script first. Companion buttons and REST commands both just call the script, so behaviour is defined once and the surface stays dumb. The deploy script generates Companion-shaped identifiers to match the app's own format, renders a named colour palette per row into Companion's packed integer colour format, and writes the controls and pages tables directly.
A small systemd service polls the media player entity every five seconds, fetches the artwork, resizes it, composites a scrim, the track title and a green or grey play-state dot, and posts the result to the play button's style endpoint, only redrawing when state, title or artwork has actually changed.
Details that came from use
The colour-temperature buttons step each bulb from its current value with per-bulb clamping, because one rear light clips at 4000 K while the others go to 6500 K. Mute routes through a Home Assistant script because Companion cannot express a Sonos mute toggle cleanly. Brightness moves all four office lights together in one action.