# Smart Home for AgentBuff

> The Smart Life and Tuya devices a home already has, controlled by chatting with an AI agent on AgentBuff: lights, ACs, plugs and cameras, with scenes, schedules, automations and a yes from the owner before risky devices turn on.

Many Indonesian homes already run lights, plugs, ACs and cameras through the Smart Life app, yet controlling them still means opening the app and tapping through rooms. People who talk to an AI agent every day want to say "turn off all the bedroom lights" instead. Smart Home for AgentBuff, sold as Buff Tuya, connects that home to the owner's agent in three steps, with no developer account and no computer left running at home.

- Heaters, kettles, garage doors and valves turn on only after the owner says yes in chat; turning things off is always allowed.
- After every command the server reads the device state back, so the agent never reports a change that did not happen.
- One key from tuya.ai pasted into a three-step wizard, with no Tuya developer project to create or renew.

- 31 MCP tools for one home
- 324 AC remote code sets in the library
- 3 steps to connect, no developer account

- Role: Founder & CEO, designer and builder
- Company: AgentBuff
- Period: Since Oct 2026
- Stack: Next.js 16, React 19, TypeScript, Tailwind 4, Radix UI, Node 22, PostgreSQL 16, Drizzle ORM, MCP, Vitest, Playwright, Docker Compose
- Live app: tuya.agentbuff.id (https://tuya.agentbuff.id)
- Showcase on GitHub: nugrahalabib/agentbuff-tuya-showcase (https://github.com/nugrahalabib/agentbuff-tuya-showcase)

## The problem

Smart devices are already common in Indonesian homes, and most of them run through the Smart Life or Tuya Smart app. Controlling them still means opening the app and tapping through rooms. For someone who already hands daily work to an AI agent in chat, the natural move is to write "turn off all the bedroom lights" and be done.

The community MCP servers for Tuya were built for developers. They need a Tuya developer cloud project that must be renewed every six months, or they run on the home network next to the devices. **None of them is a multi-user web service with a login that a non-technical owner can buy and connect in a few minutes.**

Tuya's end-user API also leaves gaps that matter in a real home. It has no scenes. It answers success when the cloud accepts a command, not when the device acts. And an AC that only has an infrared remote cannot be controlled by an outside app without its remote codes.

*What changes at home*

| Before | With Smart Home for AgentBuff |
| --- | --- |
| Open the Smart Life app and tap through rooms to switch things off | Say "turn off the bedroom lights" in chat and the agent does it |
| Community servers need a developer cloud project or a computer on the home network | One end-user key from tuya.ai, pasted once into a three-step wizard; the service runs in the cloud behind a login |
| An AC with only an infrared remote stays outside every routine | Pick the brand, test a remote code once, and the AC works from the app and from chat |
| No scenes and no rules that react to sensors | Scenes, schedules and automations are stored and run by the service |
| An agent says "done" when the cloud only accepted the command | The server reads the state back and tells the agent when a change is not confirmed yet |

## Who it serves

- Home owner: Buys the app on the AgentBuff marketplace, connects the home once, then controls it by chat or in the web app.
- The owner's AI agent: Calls the MCP tools to read the home, control devices and set up scenes, schedules and automations, and reports results honestly.
- AgentBuff: Signs the owner in, answers whether access is still active, and installs the connector on the agent after purchase.
- Other MCP clients: Advanced users create a manual token and point any MCP client at the same server.

## From purchase to a home that answers

**Connecting a home and using it from chat** (The Tuya key goes into the web app once. It never passes through the chat.)
1. Buy: AgentBuff installs the connector on the agent
2. Sign in: Sign in with AgentBuff on the web app
3. Get the key: Scan a QR code on tuya.ai with Smart Life
4. Discover: Homes, rooms and devices appear in the app
5. Ask in chat: "AC at 24 degrees, cool mode"
6. Act and verify: The server checks the device reported the change

The wizard walks the owner through tuya.ai with small pictures for each step. As soon as the key is pasted, the app reads the region from the two letters after sk-, so nobody has to know which Tuya data center they use. The key is checked with Tuya before it is saved, stored encrypted and never shown again. **The agent never receives it.** If the owner pastes a key into the chat, the agent sends them to the connect page instead, because a key in a chat transcript could switch on a heater.

## Inside the product

The web app follows the calm style of Apple Home. Devices are grouped by room in the same order as the Smart Life app, a summary line says what is still on and what is offline, and changes made by the agent, a schedule or a sensor reach the browser live.

**Home**
One tap switches a tile, and the dots open the device sheet. The summary offers to turn off everything that is still on, and each room has its own Turn all off.

*Home overview by room on the invented Demo Home.*

**Devices**
Each sheet is built from the device's own model: a light shows mode, brightness, colour and a timer; an AC shows set point, mode, fan and swing; a plug shows power use; a camera takes a photo or a 10 second clip.

*AC sheet with set point, room temperature, mode, fan and swing.*

**Scenes**
Tuya's end-user API has no scenes, so the service stores them. A scene saves the current state of chosen devices under a name, icon and colour, and each card shows the sentence to tell the agent.

*New scene: name, icon, colour and the devices whose state is saved.*

**Schedules**
Schedules run a device action or a scene at a time, on chosen weekdays or as a one-off timer. They store friendly commands and translate them at run time, so a model update from Tuya does not break them.

*New schedule: every day at 18:30, turn on the ceiling light.*

**Automations**
Automations react to a door opening, motion, a temperature, CO2 or power reading crossing a value, or a device going offline. Actions can be device commands, scenes, a notification to the Smart Life app or a camera photo kept for 7 days.

*Automations made through the agent; two already ran on simulated sensor events.*

## Safety before convenience

*The kettle is marked: the agent must ask before turning it on.*

A home is not a spreadsheet. Some devices can hurt someone if they switch on while nobody is watching.

- **Sensitive by type**: heaters, kitchen appliances, garage doors, water valves and locks are marked in code, and the owner can mark any other device.
- **Off is always fine**: the agent may turn these devices off at any time, but turning one on needs the owner's yes in chat first.
- **No unattended start**: the same rule blocks an automation that would switch on a sensitive device on its own.
- **Clear answers**: offline devices and ambiguous names return their own codes, so the agent asks or explains instead of guessing.

*Real agent calls on a local run: refused without confirmation, allowed with it, an automation refused, and an offline device.*

Some things stay in the Smart Life app on purpose, and the agent is told so: Tuya's API does not allow unlocking door locks, live video, pairing new devices, firmware updates or editing homes and rooms.

## Air conditioners with only a remote

Many ACs in Indonesia still come with only an infrared remote. Tuya does not send remote signals for outside apps, so the service ships its own library of **324 AC remote code sets**, built from the open SmartIR project (MIT licence) and ordered by the brands common in Indonesia. The owner picks the brand, can search by the model code on the sticker, then tests codes one by one or lets auto search send them five seconds apart. Each test turns the AC on at 27 degrees with high fan and swing, so a full match is easy to see.

After pairing, the sheet is honest about the limit: the real state of an infrared AC cannot be read back, so it offers a Resend button instead of pretending.

## How the agent connects

Owners sign in with AgentBuff, an OpenID Connect login with PKCE and a separate user id for each app. After purchase AgentBuff installs the connector and a companion skill on the owner's agent, so there is no token to paste: AgentBuff sends a short-lived signed assertion that works once, and the service issues a normal 90 day MCP token whose hash is the only thing it keeps. The MCP server publishes **31 tools**, each marked as read-only, write or destructive, and writes its results in Indonesian so the agent can pass them on as they are.

*The 31 tools from the running server, grouped by purpose, with their MCP hints.*

*Activity log: who asked for each action, the owner, the agent, a schedule or an automation.*

Every action records who asked for it, so the owner can always see what the agent did and when.

*Access paused: homes, scenes and schedules are kept until access returns.*

When access ends, the web app pauses and the MCP server refuses tools, but nothing is deleted. If AgentBuff cannot be reached, the last good answer holds for up to 72 hours, so an outage never switches off someone's home.

## How it is built

- Read the state back: After each command the server checks what the device reported and tells the agent confirmed or not confirmed.
- A sealed key: The Tuya key is encrypted with AES-256-GCM in an envelope bound to its owner, opened only on the server right before a Tuya call, never logged.
- One owner, one home: PostgreSQL row level security is enabled and forced on every owner table, and application roles cannot bypass it.
- A worker that keeps time: A separate worker holds one live connection per home, runs due schedules every 20 seconds and fires an automation once when its condition becomes true.
- Tested without hardware: Integration tests run the real services against a fake Tuya cloud that records every command and can simulate offline devices.
- Deploys that keep data: Each deploy backs up first, counts rows in every table and fails if any table shrank; backups run every 6 hours and are kept 14 days.

**At a glance**
- Product: Smart home control for AgentBuff agents, sold as Buff Tuya
- Works with: Tuya and Smart Life devices
- MCP tools: 31
- AC remote code sets: 324
- Connecting a home: 3 steps, no developer account
- Languages: Indonesian and English
- Affiliation: Independent app, not affiliated with Tuya Inc.

**Want your product to work from an AI agent's chat?** I build MCP servers where the agent can act, people confirm what matters, and every result is checked.

Source: https://nugrahalabib.com/work/smart-home-agentbuff
Author: Nugraha Labib Mujaddid (https://nugrahalabib.com)
Published: 2026-11-27. Updated: 2026-11-27.
