Dev.to AI 🤖 Ai 👁 0 📖 7 min read

An AI Agent Built My Thermostat's New Brain — Here's How It Actually Went

This is part 2 of a series. Part 1 covered the idea: teaching a thermostat to look outside before deciding whether to run. At the end of the last post I promised to dig into the comfort problem — why 23°C feels differen

This is part 2 of a series. Part 1 covered the idea: teaching a thermostat to look outside before deciding whether to run.

At the end of the last post I promised to dig into the comfort problem — why 23°C feels different on a 30° day than a 17° day. That post is still coming. But when I described this project to people, the question I got wasn't about the thermostat at all. It was: "Wait — the AI built it? Like, actually built it?"

Fair question. So before we get to comfort, this post is about the build itself: what it looks like when an AI agent implements a real system on real hardware in your actual house, what it did that surprised me, what broke along the way, and which decisions still landed back on my desk.

The setup

The ingredients:

  • The house: Home Assistant OS running my smart home, an Ecobee thermostat, and two sources of outdoor temperature — a weather forecast service and the Ecobee's own feed.
  • The agent: Claude, working in a mode where it drives a real Chrome browser session and has file access to a project folder for documentation.
  • The brief: build the whole system from part 1 end to end — verify the entities, create the sensors and helpers, write the automations, build a dashboard to watch it all. I asked it to prefer Home Assistant's UI, with YAML allowed for the genuinely complex bits.

One detail that matters: I never handed over an API key or token. The agent worked entirely through the browser session where I was already logged in to Home Assistant — the same access I'd have sitting at my desk. That constraint turned out to shape the whole build, in a good way.

The part that surprised me: it didn't click around like a person

I expected to watch a cursor crawl through Home Assistant's menus — open Settings, click Helpers, fill in a form, repeat forty times. That's not what happened.

Early on, the agent figured out that since it was operating inside an authenticated Home Assistant tab, it could talk to Home Assistant's own internal API — the same one the UI itself uses behind the scenes. Instead of screenshotting dialogs and hunting for buttons, it created the template sensors, statistics sensors, tuning sliders, automations, and even the dashboard programmatically, through the front door the platform already had open.

Think of it as the difference between dictating a letter to someone who types it key by key, and someone who just... writes the letter. Same authorization, same result, dramatically more reliable.

And here's the part I appreciated most: everything it created this way is a completely normal Home Assistant object. Every sensor, automation, and slider shows up in my UI, fully editable, exactly as if I'd clicked through the forms myself. No mystery YAML files, no fragile side-channel.

The workflow that emerged

Watching the build, a clear discipline showed up, one that honestly, plenty of human engineers skip:

  1. Verify reality first. Before building anything, it queried the live system: which thermostat entity is real, what units everything reports in, whether enough history was being recorded to learn the house's passive drift rate. It discovered there was no plain "outdoor temperature" sensor at all, the number lived buried inside the weather entities, so it knew up front it would need to build wrapper sensors.

  2. Validate the math before committing it. Every formula — the differential, the drift rate, the minutes-to-setpoint prediction — was test-rendered against the house's live data before being saved as a real sensor. A dry run with no side effects: "does this expression produce a sane number right now?" Only then did it become permanent.

  3. Build in layers. First the data layer (sensors that measure and predict), then the control layer (the automations that place and release holds), then the surface (a dashboard with gauges, trends, tuning sliders, and an audit log of every hold the system places).

  4. Document as it went. It kept a running reference doc in the project folder, every entity, every automation, every decision and why. By the end I had a complete, accurate map of the system. (It's also why writing this series was easy.)

Then the finale: a live test on the actual thermostat. One real end-to-end cycle — place a hold, watch the house drift up through the deadband, watch the release rule fire and hand control back to the schedule. The full loop from part 1, observed on real hardware, exactly once. Careful, but not timid.

The clever bits

A few design details the agent got right that I'd flag for anyone building something similar:

  • Separate flags so the system can't sabotage itself. The "coast to the setpoint" hold and the "stop the overshoot" hold each got their own marker. That way each release rule can only undo its own hold, and neither will ever touch a hold I set manually. Without that, two well-meaning automations can quietly fight each other.

  • Save the real setpoint before overwriting it. The overshoot clamp works by temporarily shoving the setpoint somewhere the HVAC won't chase. The agent stored my true target in a helper first, so the release always restores exactly what I'd asked for. Obvious in hindsight; easy to forget until the day your thermostat "forgets" your schedule.

What broke (because something always breaks)

An "AI built my smart home" post that claims nothing went wrong is selling you something. Here's the actual friction:

  • A broken add-on forced a better path. The clean route, editing the configuration file directly, was blocked because my file editor add-on was in an error state. Rather than rabbit-holing on a fix, the agent pivoted to building everything through the UI-level APIs instead. Which, conveniently, matched my stated preference and meant no risk of a bad config edit taking the whole system down on restart.

  • The connection kept dropping. Several operations failed with an error that was literally just the number 3. The agent identified it as Home Assistant's connection-lost code, reloaded the tab to re-establish the session, and retried. Unglamorous, effective.

  • Things that looked broken but weren't. New automations got assigned IDs derived from their names, not the internal keys the agent chose — so its first "did that save?" check came back as a false failure. Reading an automation back returned a newer config format than the one it was written in. Dashboard cards below the fold didn't render until scrolled, making a complete dashboard look half-built. Each one took a beat of diagnosis; none was an actual defect.

The pattern across all of it: the agent treated every surprise as a diagnosis problem, not a retry-harder problem. Check the saved state, find the real explanation, then proceed. That instinct mattered more than any individual fix.

Where the human still mattered

This is the takeaway I'd most want you to leave with. The agent was an excellent implementer and a decent diagnostician. But the decisions that shaped what the system values were still mine:

  • Which "outside" to trust. My forecast source and the Ecobee's weather feed disagreed by nearly 3°C — and at times disagreed on which direction heat would flow, which flips the entire decision. The agent surfaced the conflict clearly. Choosing which number represents reality for my house? It handed that back to me, correctly.

  • The core insight itself. The rule from part 1 — only stop the overshoot when the weather won't recover it — started as my intuition about banked thermal energy. The agent's job was translating that intuition into precise, testable conditions. It sharpened the policy; it didn't invent it.

  • Knowing what not to touch. My utility pre-cools the house during peak demand events. An overzealous overshoot clamp would quietly sabotage a program I actually want. Recognizing that and carving out an exception was a domain call only I could make.

  • Comfort trade-offs. How far past the setpoint to tolerate, how long to wait for the weather to do its work — the agent picked sensible defaults and wisely made them sliders rather than constants. The right values are personal, and it built the system to acknowledge that.

The shape of the collaboration: I supplied intent and judgment, it supplied mechanism and verification, and the best results came from the back-and-forth, me refining what the system should want, it refining how to get there.

Takeaways

If you're thinking about pointing an AI agent at your own infrastructure:

  1. Agents are strongest working through a system's own APIs, not by imitating a human at the controls. Watch for that move, it's the difference between a brittle demo and a real build.
  2. Insist on "verify before commit, on live data." Test-render the logic, then run one observable end-to-end cycle. It's cheap and it catches almost everything.
  3. Keep the policy decisions. Which inputs to trust, what the system should optimize for, what to leave alone, that's a conversation, not a delegation.
  4. Make it document as it goes. The running reference doc cost nothing in the moment and paid for itself many times over.

Next up, the post I originally promised: the thermostat now knows what the weather is doing, but hitting the setpoint still isn't the same as being comfortable. Why the number on the thermostat is the wrong thing to measure, and what I'm building to chase comfort instead.

Part 3 coming soon.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.