← Back to library

Remap harsh lights and go red at bedtime

Pieter Levels had AI rework his Home Assistant rules: whenever the glaring white ceiling spots that came with his home get switched on, they are cut at once and his softer indirect strips light up instead. At 10pm everything goes dark, and lights that can change color return in red only.

  • OutcomeAsk an AI to rewrite your Home Assistant automations so the harsh fixtures never turn on and every light shifts to red at night.
  • SetupUnder an hour
  • LevelIntermediate
  • CreditPieter Levels (@levelsio)
View original
Works with
Custom agentClaude

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?

  • Built-in fixtures are too harsh
  • You want a bedtime light routine
  • You run Home Assistant

Not for: Rentals where rewiring is not allowed; Homes where others need bright light late

What do you need, and what do you get?

You need

  • Home Assistant access
  • List of light entities
  • Preferred bedtime

You get

  • Automation that intercepts the harsh lights
  • Nightly red-light scene

How does it work, step by step?

  1. List your lightsExport entity names and which support color.
  2. Describe the ruleTell the AI which fixtures to suppress and what to turn on instead.
  3. Review the YAMLRead the generated automation before saving it.
  4. Add the night sceneAt your chosen time, switch everything off and turn color lights red.
  5. Keep an overrideAdd a way to get full light quickly for emergencies or cleaning.

The prompt

Our own prompt, inspired by Pieter Levels (@levelsio) and written to work in Custom agent and Claude. Values in lime are placeholders.

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

Prompt6 variables
Here are my Home Assistant light entities: {entities}. Color capable: {color_entities}.
Write automations that: 1) whenever {harsh_lights} turn on, immediately turn them off and turn on {soft_lights} instead; 2) at {bedtime}, turn all lights off, then set color-capable lights to dim red.
Add an override switch called {override_name} that disables both. Show the YAML and explain each part before I apply it.

Inspired by Pieter Levels (@levelsio): Today I hacked my Home Assistant with AI to nuke the bright white LED spots that came with my house when I bought it. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Suppressing a light everywhere can leave a room dark when someone needs it.
  • Wall switch signals differ by brand; test each one.

Our take

Pieter Levels had AI rework his Home Assistant rules: whenever the glaring white ceiling spots that came with his home get switched on, they are cut at once and softer indirect strips light up instead, plus a red night mode at bedtime. This is a nice example of describing intent rather than writing configuration. Say what should happen whenever a certain light is asked to come on, and let the AI work out the automation. Export your entity names and note which lights support color, then describe the rule and read the generated YAML before saving it. Suppressing a fixture everywhere can leave a room dark when someone needs it, so add a quick override for full light in emergencies or while cleaning. Wall switch signals differ by brand, so test each one. Check that others in the home are happy with the bedtime routine. Rentals may limit what you can change.

Where the time goes back: A fiddly evening of writing automations becomes a short request and a review.

FAQ

Why red at night?
Many people find dim warm or red light less disruptive before sleep; it is a preference, not a cure.
Can the AI edit Home Assistant directly?
It can, but reviewing the change first is safer.

Source and credit

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

Inspired by
Today I hacked my Home Assistant with AI to nuke the bright white LED spots that came with my house when I bought it
Creator
Pieter Levels (@levelsio)
Published on
X
Original date
Apr 22, 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

Hand phone-only reservations to an MCP calling tool

Give an assistant a calling tool so it can phone places that only take bookings by phone, and answer follow-up questions mid-call using details you provide.

Credit: Jake Marsh (@jakemarsh)

Under an hour
Food & HealthWorkflow✓ AI dry run

Meal plan to a grocery order you approve

Plan two weeks of dinners from household feedback, turn them into a shopping list with pantry top-ups, and let a browser agent fill the cart while you confirm payment.

Credit: u/WeezerHunter on r/ClaudeAI

An afternoon+
Food & HealthWorkflow✓ AI dry run

A local-model grocery skill built from your recent orders

Give a local model a grocery skill with a rough fridge inventory, your last ten typical orders and live stock data, then let it fill the cart.

Credit: eurekin on Hacker News

An afternoon+
Food & HealthWorkflow✓ AI dry run

Let a pose camera switch your fan at night

Run a local pose model on a home server that reads your sleeping position and presses the fan switch when you look hot or cold.

Credit: Pankaj (@the2ndfloorguy)

An afternoon+