Mask off in their sleep? The lights flash. Claude Code wrote the logic
Taking off a CPAP mask overnight kept happening, so Claude Code wrote logic that flashes the lights when the mask comes off. Turning it off means walking across the house, by which point they're too awake to repeat it.
Done withClaude CodeSpotted· by HN user swe123456· Oct 28, 2026
Result Built from a presence sensor, smart light and a plug
“I can't get around this system at all without walking across the house to my desktop, at which point I'd be too awake to be stupid enough to remove the mask.”
Spotted: found in the wild. Details are as reported by the source above and have not been independently verified.
What they did
They wanted to stop removing their CPAP mask in their sleep, so they combined a presence sensor, a smart light and a power-monitoring smart plug with Home Assistant and AppDaemon. They used Claude Code to write the automation logic that triggers an alert when the mask is removed during sleep hours.
How it went
The lights flash if the mask comes off during the sleep period, and silencing the alarm requires walking across the house to the desktop, by which point they say they are too awake to be stupid enough to remove the mask.
Try it yourself with Claude Code
Using [Home Assistant / AppDaemon], write an automation that checks whether it is [your sleep period], a [presence sensor] shows I'm in bed, and a [smart plug's power draw] for [a device] stays below a threshold for a few minutes, then flashes a [smart light] until the device is reconnected. Review the automation logic yourself and test it with the real devices before relying on it overnight.
A starting prompt written by Agents in the Wild. Fill in the [brackets], and check what the agent does before it sends, pays for or deletes anything.
A private WoW server for the family, across 2 PCs, a Steamdeck and a MacBook Pro. Claude Code set it up while they played tennis, and 2 hours later it was 99% done: just some mouse settings left.
A baby camera mount made from a box with two pins that end in a cone shape. With calipers, a few minutes with Claude Code and some iteration with the print, it works surprisingly well.
No iOS or Swift experience and only an hour here and there with young kids. Claude Code helped build a very nicely responsive, real-time syncing groceries app in what amounts to a weekend of time.
Their daughter is learning piano. A USB cable into a 10-year-old Casio, Claude Code, and minutes later a working falling-note game. She immediately took over as product manager, requesting features and catching bugs.
Designing furniture in OpenSCAD used to mean hours on even a minimal project. With Claude Code and code they reuse, a new design, cutting-blueprint PDFs included, now takes a couple of hours.
Asked to set up Home Assistant and a voice agent on a Raspberry Pi with root access, Claude Code found the Home Assistant API too difficult. It instead SSHed into the Pi on its own and used Espeak to speak to them.