The box within reach of the couch: a Raspberry Pi 3B with the AIY Voice HAT, from the first household's configuration, made generic. - box/body: the button service, in Python: press and talk, turns by voice, a press interrupts; the look signal - box/*.js: the ir and look capabilities, behind gates, for the brain; the ask client, the box's side of a conversation - box/module.nix: the services, each confined to the devices and addresses it needs; the private network as an option (a tailnet by default); the Pico found by its USB IDs, as /dev/pdtv26-ir - box/voicehat.nix: the Voice HAT's device tree overlay and ALSA setup - lib.mkBox: a box's whole system from its name, the home server's, the Wi-Fi network's, and who looks after it - checks: box-js, box-py (doctests and pyflakes), and box-system (an example box's system evaluates) Generated-by: Claude Opus 5.5
64 lines
4.3 KiB
Markdown
64 lines
4.3 KiB
Markdown
# Peace and Dignity at the TV: delegating the remotes to an agent
|
|
|
|
Watching TV used to mean turning the dial to 4 (NBC), 5 (CBS), or 9 (ABC). Now one stray press of the **Input** button leaves a "No Signal" screen with no obvious way back; the TV comes on but the cable box doesn't; the sound disappears because a menu sent it somewhere else. Rather than inflict this mess on our elders, we can respect them: let them say what they want, and delegate the details of handling the devices to an agent.
|
|
|
|
Part of the agent is a box within reach of the couch: press its button and talk. Its ears and voice, speech recognition and synthesis, run on a computer at home, so recordings of you never leave the house; the language model behind it sees only a transcript.
|
|
|
|
## "Put on the ballgame," says Dad
|
|
|
|
One request from the couch becomes a dozen steps for the agent, with a look at the screen when it needs one:
|
|
|
|
```
|
|
Dad: [presses the button] Put on the ballgame.
|
|
↳ notes: the home team, and the cable lineup
|
|
↳ web search: today's game, start time, which network
|
|
↳ ir: TV power, cable box power
|
|
↳ ir: Input, to the cable box
|
|
↳ ir: channel 6, 1, 4, Enter
|
|
↳ look: the game?
|
|
Agent: Here's the game. It started ten minutes ago.
|
|
```
|
|
|
|
The game isn't on 4, 5, or 9. It's on a sports network in the hundreds, behind two **Power** buttons, the **Input** button, and the cable box's remote. Our elders have done their share; let the agent do this.
|
|
|
|
## How it works
|
|
|
|
The agent has two parts: the box within reach of the couch, with an IR emitter on a cord where the TV can see it, and a home server that runs speech and the brain; the diagram draws those two apart, since they can be.
|
|
|
|
```
|
|
near the couch speech server brain host
|
|
┌───────────────┐ hear ──▶ ┌──────────────┐
|
|
│ the box │ speak ──▶ │ whisper.cpp │
|
|
│ Pi 3B │ │ piper │
|
|
│ AIY Voice HAT │ ask ──────────────────────────────▶ ┌──────────────┐
|
|
│ button + LED │ │ brain, in │
|
|
│ │ ◀──── ir (learn, send) ───────────── │ bwrap, with │
|
|
│ │ ◀──── look (one frame) ───────────── │ an MCP chan. │
|
|
└───────────────┘ └──────────────┘
|
|
└─ USB cord ─▶ Pico IR ──▶ TV, cable box
|
|
```
|
|
|
|
1. A press of the box's [button](box/body/box.py) starts a conversation, and a chime says it's your turn.
|
|
2. The box records the clip and, with its [`speech` capability](#capabilities-and-confinement), has the speech server transcribe it (whisper.cpp).
|
|
3. The box sends the text to the brain with its `ask` capability.
|
|
4. To act, the brain uses its capabilities on the box: [`ir`](box/ir.js) (send a learned code through the Pico) or [`look`](box/look.js) (one still frame from a camera aimed at the TV; the box flashes its LED and taps a sound on every look, so there's no unannounced looking).
|
|
5. With the same `speech` capability, the box has the speech server voice the brain's reply (piper), and plays the WAV.
|
|
|
|
## Capabilities and confinement
|
|
|
|
An agent in the living room should be able to do what it's for, and no more. A capability is a reference that both names a service and grants the right to use it. Each part holds capabilities for exactly the services it uses. The brain can press IR buttons and take one camera frame, but it can't reach a shell on the box or anyone's files.
|
|
|
|
The parts talk over [Cap'n Web](https://github.com/cloudflare/capnweb); [CONTRIBUTING](CONTRIBUTING.md#capabilities-on-the-wire) says how.
|
|
|
|
## Parts
|
|
|
|
The agent is built from parts you can buy and solder:
|
|
|
|
- **The box:** a Raspberry Pi 3B with a Google AIY Voice Kit v1 (speaker, two mics, the button), running [NixOS](box/module.nix).
|
|
- **The IR emitter:** a Raspberry Pi Pico H with an IR transceiver ([wiring](ir-pico/wiring.md)), on a USB cord from the box, aimed at the equipment.
|
|
- **The camera:** an RTSP camera on the LAN, aimed at the TV.
|
|
|
|
## License
|
|
|
|
[Apache 2.0](LICENSE)
|