What it does
The Car Thing was Spotify’s discontinued in-car gadget: a small touchscreen with a big dial and four buttons. Mine sits on my desk and controls the room.
- Turn the dial: all three speakers get louder or quieter together, keeping their balance.
- Tap a speaker’s fader: the dial controls just that one for a few seconds.
- Buttons 1–3: recall presets (desk, bed, ambient). Press save, then a number, to store the current mix.
- Button 4: flips to a now-playing screen with album art and playback controls.
- Back button: opens a grid of playlist covers.
- Previous track: restarts the song, or goes back a track if you’re in the first 5 seconds, like most music players.
- When nothing is playing: the screen shows a clock, with Snoopy and Woodstock.

How it works
The Car Thing has no WiFi and no internet, so everything goes through the Pi.
- The device runs a single-page web app (vanilla HTML and JS, no build step) in the kiosk browser it ships with, Chromium 69. The hardware buttons arrive over a local websocket, and the dial arrives as scroll events.
- A USB tunnel (
adb reverse) is the device’s only route to the Pi. A watchdog service keeps it alive. - A Flask server on the Pi keeps one persistent connection open to each speaker, with a writer thread per speaker that only ever sends the latest volume. It also proxies every Spotify call, so no secrets ever touch the device.
- systemd restarts everything on boot. The screen turns its own backlight off whenever it can’t reach the Pi.
- May 2026First version on my Mac, with Home Assistant in Docker, started whenever my monitor was plugged in.
- Jun 2026Moved to a Raspberry Pi 2 so it runs 24/7. Added playlists and speaker-group playback.
- Sep 2026Tracked down the volume runaway bug, rebuilt the USB tunnel watchdog, and profiled and overhauled performance for the Pi 2.
- Sep 2026Fixed Cast connections that died silently.
- Oct 2026Added CI (36 tests, plus checks for the device's old browser) and automatic deploys from GitHub to the Pi, with health checks and rollback.
What broke
Making a Pi 2 fast
The Pi 2 has a 900 MHz ARM chip and 1 GB of RAM, and turning the dial felt laggy. Before rewriting anything, I measured: a volume change took 1,177 ms of wall-clock time but only 47 ms of CPU. The server wasn’t slow; it was waiting. So a rewrite in a faster language wasn’t the answer.
The fixes were about waiting less:
- Reusing connections instead of reopening them.
- Merging a burst of dial clicks into one request (10 clicks became 2 requests).
- Caching album art.
- Replacing a canvas-drawn UI with plain text.
| Before | After | |
|---|---|---|
| Dial → speaker | 1,177 ms | 84 ms |
| Album art | 364 ms | 86 ms |
| Now playing | 394 ms | 225 ms |
| UI render CPU | 5.2% | 0.1% |
| Idle server CPU | ~1.3% | ~0.8% |
Shipping it
Deploying used to be a list of commands typed over SSH: copy the files, restart the server, unlock the Car Thing’s read-only filesystem, push, sync, lock it again. Skip the sync and the next reboot quietly undid the change. The Pi had also drifted from git, running code that was never committed.
Now every pull request runs three checks:
- 36 tests for the server, with fake speakers and a stubbed Spotify, so they never touch real hardware.
- Linters set to the Car Thing’s Chromium 69. They fail on features it doesn’t have, like optional chaining or flexbox
gap, which would otherwise break silently on the device. - ShellCheck on the scripts.
Merging to main deploys it. GitHub Actions joins the Pi’s private Tailscale network and runs a deploy script that only touches what changed, which takes 3–28 seconds. Then it checks with real requests: the server answers, the files on the Car Thing match, and the Car Thing can reach the server through its USB tunnel. If anything fails, it restores the previous version. I tested this by deploying a deliberately broken commit, and it rolled itself back in 75 seconds.
Access is locked down at every step. No ports are open on my router, and no Tailscale secret is stored: GitHub proves the job’s identity directly. CI can reach only SSH on the Pi, and its key can run only one script, which accepts only commits already on main.
| Before | After | |
|---|---|---|
| Deploying | Manual commands over SSH | Merge a pull request |
| A broken deploy | Stays broken until I notice | Rolled back automatically |
| Pi matches git | Drifted | Enforced |
What I’d do next
Rollback takes 75 seconds because a server that crashes on startup is only noticed when the health check times out. Watching systemd’s restart count would catch it in seconds. I’ve also started a second screen, an HDMI dashboard driven by the same Pi.
