Friday night: make one lamp answer to you syllabus

Get it clicking, badly

Build the whole loop before improving any part of it. A pipeline you can run end to end is a thing you can measure; four good components you have never connected are four guesses.

Before anything is plugged in

This build stays on the safe side of the socket. Everything here runs through a commercial plug that is already certified for mains; you are never inside it.

Four legs, one wire

The loop is shorter than it looks:

  1. Capture — the microphone runs until something decides you stopped talking.
  2. Transcribe — audio becomes text.
  3. Decide — text becomes a command.
  4. Actuate — the command becomes an HTTP call, and the relay clicks.

Every one of these can be the slow one. The point of tonight is that by the end you will know which, on your kit, rather than which the internet says it usually is.

Click the relay from one line

Find the plug's address on your network — its app will tell you, or your router's client list will. Then switch it from the command line. No script, no library, nothing installed.

If the plug does not answer on the LAN, it is a cloud-only device and it cannot be part of this build. Swap it before going further; everything downstream measures a round trip you would otherwise not control.

Bolt a microphone to the front

Now the ugly version. Record until you go quiet, send the audio to whichever hosted transcription API you already have keys for, and match the text against a short list of phrases. Fire the curl from the previous step when it matches.

Use plain string matching, not a language model, for this first pass. You have four commands and a fixed vocabulary; a matcher that cannot hallucinate is the correct tool, and keeping it dumb tonight means the latency you measure next lesson is not hiding an inference call you did not need.

Why not a model for the matching?

You have four commands. Why start with string matching rather than a small language model for intent?

How long from your last word to the click?

Say the phrase, and time from the moment you stop speaking to the moment you hear the relay. Do it five times and take the middle value.

The honest way to get this: put your phone next to the lamp, record, and read the gap between the end of your voice and the click in any waveform editor. Your own logs cannot see the plug's delay, and the plug's delay is part of what the room experiences.