← All use cases

Use case P48 · Human

Christmas-tree owner uses Claude Code to make a one-button webpage for his Kasa smart plug

Velu Sankaran ·

The short version

What they did

Velu Sankaran wanted to switch his Christmas-tree lights without navigating the Kasa app. He had Claude Code build a small Python web app with a button showing the plug’s state, then corrected the device address when needed. He says it works from his phone, but the article’s localhost and home-network descriptions are imprecise; the app has no authentication and its security was not tested here.

Result (as claimed)

“Twenty minutes later, I had a working app.”

“And I can turn it off with a single tap.”

Prompt

Their prompt:

I’m exploring an idea of controlling a tplink mini switch from this laptop. What do you say, you up for a quick vibe project?

A fuller version to copy:

I want Claude Code to build a one-button webpage for my Christmas-tree lights. The lights use my [TP-Link Kasa plug model] on [home network]. My computer runs [operating system], and the plug’s address is [address, or ask me to confirm it].

1. Use python-kasa to find the plug and read its current state. Confirm the correct device with me.
2. Test switching it on and off, then build a small Python webpage with one button and a clear on/off display.
3. Show me how to open the page from my phone on home Wi-Fi and stop the app when needed.

Give me short instructions in plain words. Report failed connections instead of displaying a guessed state. Keep the page on my home network, and do not control any other plug without asking.

Do it yourself

These steps are my suggested way in, not Velu’s setup.

What you need

  • A TP-Link Kasa smart plug on your home Wi-Fi.
  • A computer on the same network with an AI coding agent, such as Claude Code.
  • The free python-kasa library, which the agent can install.

Start simple

  1. Give Claude Code the prompt above. Let it find the plug on your network.
  2. Have it switch the plug on and off from the command line first.
  3. Ask for a one-page web app with one button that shows whether the plug is on.
  4. Open the page on your phone over your home Wi-Fi.

Take it further

  • Add a schedule: lights on at sunset, off at bedtime.
  • Add a button for each plug.
  • Connect the plug to Claude as a tool, so you can ask whether you left the lights on.

Check your work

  • Give the plug a fixed address in your router, so the app doesn’t lose it.
  • The page has no password. Keep it on your home network and don’t expose it to the internet.
  • Use remote switching only for lights and small loads. Don’t put heaters or other high-wattage appliances on it.

Others did this too

  • Smart-home hobbyist connects Claude to his Shelly devices to check lights and turn them off. Giorgio Guidi, 2025-07-06, blog post. “Now Claude can tell me if I’ve left lights on, turn them off, or provide information about power consumption and temperature readings.”
  • Smart-home hobbyist uses Claude Code to build a terminal app for controlling his lights. Henry (Henry Needs Coffee), 2025-07-01, blog post. “That project had been in my backlog for years and I was able to generate a functioning CLI tool to handle my lights from the command line in about 2-3 hours of active time steering Claude Code.”

Source checked. The link, author, date and quote were confirmed against the source. The result itself has not been reproduced. Their prompt is quoted from the source; any fuller version is written for this library. Business size: Individual. Results are quoted as the source claimed them and never improved. Spot an error or a broken link? Email charlie@cbarmorecpa.com.

More in Gadgets, smart home and home lab

New cases go out every Saturday in Inside AI.