Build log · TK 6680 .N5

The Apparatus

One Reolink. One laptop that never sleeps. A tunnel, a function, a small database, and an email stating that a cat has gone.

The report opens in the passive voice. A subject was identified. A risk was assessed. A device was installed. Lenses, wires, relays reporting a body to a distant office: Burroughs’ control machine, except this one controls nothing. The office is an inbox. The body is a five-year-old cat.

What follows: each part, why it was chosen, how it fails. Boring on purpose. Boring breaks less at two in the morning.

How the apparatus works In the house: a Reolink E1 camera sends video over Wi-Fi to a Windows laptop, where Neolink translates it to RTSP and MediaMTX repackages it as HLS, while a motion watcher looks at the tray. The laptop sends HLS video through a Cloudflare Tunnel to stream.isnigelpeeing.com, which your browser plays. When the watcher sees motion at the tray, the laptop posts to the /api/alert function on Cloudflare Pages, which reads confirmed subscribers from a D1 database and sends one email each through Resend. The subscribe form in your browser posts to /api/subscribe, which adds you to the same database. THE HOUSE (A BASEMENT, CHICAGO) THE INTERNET (EVERYWHERE ELSE) THE EYE Reolink E1 infrared THE BRAIN Windows laptop Neolink + MediaMTX motion watch on the tray THE TUNNEL Cloudflare Tunnel no open ports FIG. 1 your browser hls.js player THE MOUTH Cloudflare Pages Functions: /api/alert /api/subscribe THE MEMORY Cloudflare D1 table: subscribers THE MAIL Resend email API INBOXES "Nigel entered the litter box." Wi-Fi HLS stream.isnigelpeeing.com POST /api/alert (with a shared secret) SELECT active one email each POST /api/subscribe NO AI, BY DESIGN
Fig. 5. The apparatus. Solid lines carry video and alerts; the dashed violet line is a subscription. Everything left of center is in a basement.

§ 1The brief

Know, at any hour, whether he has used the box, how often, and for how long. Simple to state; impossible for a person. Every early sign of a blockage happens at the box, often at night, in visits of seconds.

Three constraints. Work in the dark without lighting the room. Need nobody to keep it running. Be fixable half-asleep. That ruled out anything clever.

§ 2The eye

A Reolink E1: an ordinary indoor pan-and-tilt Wi-Fi camera, aimed at the tray and left there. Its virtue is infrared. In the dark it lights the scene with light the cat can’t see. That’s why fig. 1 is gray, and why his eyes glow — infrared reflected off the mirrored layer behind a cat’s retina. The marigold in the drawing is that.

The E1 speaks only Reolink’s own protocol, not the standard RTSP most video software expects. No sound is streamed. There is nothing useful to hear.

Eyeshine: the only part of the cat that is, technically, lit.

§ 3The brain

An old Windows laptop, set never to sleep, does three jobs.

  • Neolink, a free open-source bridge, logs into the camera over Wi-Fi and translates its feed into ordinary RTSP.
  • MediaMTX, a small free media server, pulls that stream once and republishes it as HLS, the chunked format browsers play. One pull, any number of viewers; the camera only ever has one.
  • A motion watcher looks at a rectangle drawn around the tray. Enough change for long enough, and it sends one request to the site’s alert endpoint, carrying a shared secret. That’s the whole of its intelligence. It doesn’t know what a cat is.

The laptop is the weak point and everyone knows it. Laptops update themselves, drop Wi-Fi, and get unplugged by someone hunting for a socket. When the feed is dark, it’s almost always the laptop.

§ 4The tunnel

The video has to leave a basement without making a home network public. A Cloudflare Tunnel does it: a small program on the laptop dials out to Cloudflare and holds the line open, so requests for stream.isnigelpeeing.com travel back down it to MediaMTX. No router ports opened. No home address exposed. The house makes the call; nothing calls the house.

§ 5Fig. 1, the player

A video element plays the HLS stream. Safari and iPhones play HLS natively. Other browsers get hls.js, an open-source player this site serves itself, loaded only when needed. It runs a few seconds behind live.

Most of the code is about failure, because failure is normal here. A dropped stream is retried with growing delays and narrated in the corner of the frame. A blocked autoplay just leaves the poster up until you tap. A hidden tab stops downloading. It never shows a dead black rectangle without an explanation.

Most of the code is apology. Good code usually is.

§ 6The mouth

The site is static pages on Cloudflare Pages plus a few small serverless functions:

  • /api/subscribe — the form. Checks the address, stores it as pending, sends a confirmation email.
  • /api/confirm — the link in that email. One click and the address is on the list.
  • /api/alert — the laptop’s call. Checks the secret, reads confirmed subscribers, sends each a short email through Resend: Nigel has just stepped into the box. Box to inbox: about thirty seconds. Repeat alerts within a few minutes are ignored.
  • /api/unsubscribe — the link in every email. One click; never emailed again.

The emails say when, and nothing else, because a motion sensor can say nothing else. Timestamps, not diagnoses.

§ 7The memory

Subscribers live in D1, Cloudflare’s small hosted database: one table, holding an address, a status and a date. No names, no locations, no tracking of opens. The privacy policy is short because there’s little to describe. Fonts and the video player are served from this site, not from third parties. No tracking cookies.

§ 8How it fails

  1. The laptop. Updates, sleep settings reasserting themselves, Wi-Fi, power. Remedy: off and on again.
  2. The Wi-Fi between camera and laptop. Or the camera moving to a new address on a new network. Remedy: tell Neolink where it went.
  3. False alerts. Someone scooping, a shadow, the cat sitting beside the tray thinking about it. The watcher can’t tell a visit from a loiter.
  4. Missed alerts. A visit too brief, or at the wrong angle. The feed and the scoop remain the ground truth.

Plain text: a dark feed or a missing alert is information about the apparatus, never about the cat. If you are worried about a cat, look at the cat.

§ 9What it cannot do

Diagnose. Tell urine from stool, a productive visit from a straining one, a healthy cat from a sick one. It knows that something moved in a rectangle, and when.

That’s enough. What was missing on the night of the blockage wasn’t a diagnosis. It was a record. He’s been in the box nine times since midnight sends a person to look, and looking is what saves cats.

Bentham’s panopticon put one watchman in a tower so prisoners would behave as if always seen. This is that design with the purpose removed. The watched party is unaffected. The only behavior it changes is the watcher’s, who now looks sooner.

§ 10Build your own

You don’t need any of this. Most of the value is in the simplest version: a cheap indoor camera with night vision, pointed at the box, whose recordings you scrub through each morning. Many will push a motion notification to your phone with no extra work. Start there.

For the full arrangement — public stream, email alerts — every ingredient is free or cheap at this scale and documented below. The hard part is the one no documentation covers: remembering, when the feed has been dark for a day, that the apparatus was only ever a reminder to go and look.

Works cited

  1. Neolink. Neolink: an RTSP bridge for Reolink cameras. Project documentation.
  2. MediaMTX. MediaMTX: ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server. Project documentation.
  3. Cloudflare. Cloudflare Tunnel. Developer documentation.
  4. Cloudflare. Pages Functions and D1. Developer documentation.
  5. Resend. Resend documentation.
  6. hls.js. hls.js: a JavaScript HLS client using Media Source Extensions. Project documentation.
  7. Bentham J. Panopticon; or, The Inspection-House. 1791. (For the architecture, not the intent.)

Medical disclaimer. General information from a cat owner, not veterinary advice, and not reviewed by a veterinarian. Never delay care because of something you read here. If you think your cat may be blocked, contact a veterinarian or emergency clinic now. Editorial and medical policy.

The authorScott Evens, Chicago. Not a veterinarian. Nigel is fine today. The whole story →