I Gave My Water Heater an AI Brain Over the Weekend
How I replaced my Rinnai's dumb recirculation schedule with a Python classifier, reactive trigger, and local AI chat — Friday night to Sunday afternoon.
My Rinnai tankless water heater has a 400-foot recirculation loop and a feature called Smart-Circ that's supposed to learn when we use hot water. After a year of cold showers, I decided the learning algorithm wasn't learning anything.
So I built a replacement. Friday night to Sunday afternoon. Python, SQLite, and a 35-billion parameter AI model running on local hardware in my office.
The Problem
400 feet of copper pipe. When nobody's used hot water for a while, that entire loop goes cold. The Rinnai has a pump that circulates hot water through the loop — but it runs on a dumb schedule. 3x more pump runtime than needed. 20-25/month in wasted gas on a 70 bill.
Smart-Circ is supposed to learn your patterns and pre-heat intelligently. In practice, it's a black box that needs 7 days of clockwork usage to commit to a schedule. My wife doesn't shower at exactly the same time every day. Neither does anyone.
What I Built
A Python daemon that talks directly to the Rinnai cloud API. No Home Assistant middleman. It pulls sensor data every 60 seconds: flow rate, inlet temperature, outlet temperature, burner status, recirculation state.
Then it classifies every water event:
- Is this someone using hot water, or is the pump recirculating?
- If someone's using hot water, is it a bath (2.2+ GPM, >10 min), shower (under 2.2 GPM, >5 min), or quick faucet (under 3 min)?
- Is the water cold when it starts flowing? That's a failure. Turn the pump on NOW.
That last one is the reactive trigger. When the system detects cold water hitting the heater inlet while someone has a tap open, it kicks the recirculation pump on for 10 minutes. The loop floods at 28 GPM. Hot water everywhere, fast.

The Classifier
Turns out telling the difference between "the pump is running" and "someone turned on the shower" is harder than you'd think.
The pump and a shower have similar flow rates. The key discriminator is inlet temperature. When someone opens a tap, cold water rushes into the heater before the flow sensor even registers. When the pump runs, the inlet stays warm because it's circulating already-heated water.
Three bugs found and fixed:
- Bath during recirc was misclassified — cold water beats the flow sensor by a few seconds. Fixed by using the max of the last 10 idle inlet readings as the pre-flow baseline instead of a single reading.
- Washing machine pulling hot during recirc was invisible — flow stayed above pump rate. Fixed by checking if any flow sample dips below 2.5 GPM (the washer's initial draw is a clear signal).
- Pre-flow baseline captured contaminated readings — the inlet temp drops before flow registers. Switched from last single reading to max of recent idle history.

The AI Chat
I wired a Telegram bot to the system. You can ask it /status, /events, or just chat. Non-command messages get forwarded to Qwen 3.5 (35B parameter model) running locally on an AMD Strix Halo. Zero API cost. The model gets current sensor data and today's events as context.
Key learning: smaller models confuse AM/PM times. Switched to 24-hour format. Also learned that pre-computing all stats in Python and having the model only narrate — no math — produces reliable output.
Every morning at 7 AM, the system sends a daily digest: yesterday's events, demand vs recirc ratio, estimated savings, and any anomalies. All narrated by the local AI.

The Results (5 Days)
- 50 demand events classified
- 218 recirc cycles tracked
- Peak hours identified: 7-9 PM CDT
- Saturday validation: zero demand while house empty (farmers market), all demand correlates with Ecobee occupancy sensors
- Dumb schedule runs pump 1,117 minutes vs 386 minutes of actual demand
- Estimated 70-75% pump runtime reduction
- ~20-25/month gas savings

Next: wire in Ecobee occupancy sensors and door contacts. The data shows door opens predict hot water demand by 15-30 minutes. That's the predictive layer — pre-heat before you even reach the tap.
Why This Matters
This isn't a plumbing story. It's an AI operations story.
Friday night I had a dumb water heater schedule. Sunday afternoon I had a classified event stream, a reactive trigger, a Telegram bot with local AI chat, and a daily digest — all running on hardware I already owned.
No cloud AI costs. No subscription. No Home Assistant dependency. Just Python talking directly to the API, a classifier that learns the house, and an AI model that explains what's happening in plain English.
If you can do this with a water heater, you can do it with anything.
The Stack
- Python daemon on MacBook Pro (M3 Pro)
- Local AI inference on AMD Strix Halo (Qwen 3.5 35B)
- Rinnai Cloud API (GraphQL + Cognito auth)
- SQLite for sensor data + events
- Telegram bot for monitoring + AI chat
- 5 files, ~800 lines of Python