← Back to library

Let a pose camera switch your fan at night

Pankaj built an AI roommate that watches him sleep: a MediaPipe pose model on his Raspberry Pi home server reads whether limbs are stretched out or curled up, then a button-pusher presses the fan switch. He notes blankets still confuse it. We keep the local setup and add sensible guardrails.

  • OutcomeRun a local pose model on a home server that reads your sleeping position and presses the fan switch when you look hot or cold.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditPankaj (@the2ndfloorguy)
View original
Works with
Custom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 24, 2026

When should you use it?

  • You wake up too hot or too cold
  • You already run a home server
  • Your fan only has a physical switch

Not for: Shared bedrooms where others have not agreed to a camera; Anyone uncomfortable with a camera in the bedroom

What do you need, and what do you get?

You need

  • A small always-on computer such as a Raspberry Pi
  • Camera
  • Pose detection model
  • Switch-pressing device

You get

  • Automatic fan switching through the night
  • Night log of position changes

How does it work, step by step?

  1. Keep it localRun the camera and model on your own server with no cloud upload.
  2. Define the rulesMap limbs spread out to fan on and curled up to fan off.
  3. Add a delayRequire the same position for a few minutes before toggling to avoid flapping.
  4. Wire the switchConnect a button pusher or smart plug the server can trigger.
  5. Review the logCheck each morning which toggles were right and adjust the rules.

The prompt

Our own prompt, inspired by Pankaj (@the2ndfloorguy) and written to work in Custom agent. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt5 variables
Write a small Python service for my {device} that reads frames from {camera}, runs a pose model locally, and classifies each minute as SPREAD (limbs out) or CURLED.
Only toggle the fan via {switch_api} after {hold_minutes} minutes in the same state, at most once every {min_gap} minutes.
Never save or upload images. Log timestamp, state and action to a local CSV.

Inspired by Pankaj (@the2ndfloorguy): i was tired of waking up at 3 am either sweaty or freezing. so i taught my ai roommate to automatically control the.... The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Blankets hide limbs and cause wrong reads, as the poster found.
  • Frequent toggling wakes you up; add a minimum interval.

Our take

Pankaj (@the2ndfloorguy) built an AI roommate that watches him sleep: a MediaPipe pose model on his Raspberry Pi home server reads whether limbs are stretched or curled, then a button-pusher presses the fan remote. Everything stays on a home server, which is the only way most people would accept a bedroom camera. Test false positives that turn the fan on and off all night. Keep the camera and model on your own server with no cloud upload. Map positions to actions simply, and require the same position for a few minutes before toggling so the fan does not flap on and off. Blankets hide limbs and cause wrong reads, as Pankaj found, so check the morning log and adjust the rules. Use a button pusher or smart plug the server can trigger. Anyone else sleeping in the room must agree to the camera first. Add a minimum interval between toggles so the noise does not wake you.

Where the time goes back: No more waking to fiddle with the fan; the adjustment happens while you stay asleep.

FAQ

Does video leave the house?
It should not. Process frames on the server and do not store images.
Could a temperature sensor do this instead?
Partly. Body position reacts to how you feel, while room temperature lags, so some people combine both.

Source and credit

Inspired by Pankaj (@the2ndfloorguy). We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
i was tired of waking up at 3 am either sweaty or freezing. so i taught my ai roommate to automatically control the...
Creator
Pankaj (@the2ndfloorguy)
Published on
X
Original date
Feb 20, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Custom agent
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends, bookings or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 24, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Food & Health

All 35 Food & Health playbooks →

Related playbooks

Food & HealthWorkflow✓ AI dry run

Build a private, offline health tracker by chat

Describe the readings you need to track and build a phone web app with an AI that stores everything on the device, with no account.

Credit: u/TheVPAline on r/ClaudeAI

An afternoon+
Food & HealthPrompt✓ AI dry run

Chart your blood test history from lab PDFs

See how each lab marker has moved over the years in an interactive view, instead of clicking through your patient portal.

Credit: Matt Stockton

Under an hour
Food & HealthWorkflow✓ AI dry run

Export your watch data for a plain-English review

Request a full data export from your fitness watch's website and have an AI explain what the numbers mean together and what to ask a doctor.

Credit: u/ImTheBigBad1 on r/ClaudeAI

Minutes
Food & HealthWorkflow✓ AI dry run

Train a personal early-warning model on wearables

Feed years of watch and fitness-band data to a coding agent, have it test several models against past flare-ups, and get an alert when the pattern starts again.

Credit: u/ThatAi_guy on r/ClaudeAI

An afternoon+