How I Optimized Charging My Tesla on Sunshine
Multiple attempts of frustration, then a single afternoon with my AI agent.
Recently, I came back from a five-day trip. While I was gone, my Tesla charged itself off the Sun every afternoon and didn’t pull from the grid at night. I never opened the app. My power bill for the week was lower than a normal week at home.
It took me multiple months and three attempts to get to this point. I almost gave up for good. The third attempt worked, and it worked because I stopped trying to do it alone.
Here’s what is different now.
The two times I gave up
The setup I wanted is simple. When the car is home all day, charge it from solar, not the grid, and not overnight. Keep the Powerwall full enough to run the house through the night. This combination maximizes my solar investment and lowers my grid usage.
The first time I tried, I went the Home Assistant route. Everyone in the Tesla and solar communities swears by it. In practice, the documentation was scattered across three years of forum posts, and half the integrations were community-maintained and out of date. I’d get partway through a setup, hit a wall, find a workaround on Reddit or in the Home Assistant community forum, try it, get a different error. I couldn’t tell if I was one step from working or fundamentally on the wrong path. I closed the tab after a couple of weeks into it.
The second time I wrote my own scripts against the Tesla API. Reads were easy. Writes were not. Tesla had rolled out an auth model where any command that actually does something to the car has to be cryptographically signed by a virtual key paired to the vehicle. Generate the keypair, host the public key on a domain you control, register the domain with Tesla, walk the pairing flow through the app, approve it on the touchscreen. The documentation existed. It had quietly load-bearing gaps. I gave up again.
The third attempt
The third attempt happened because I sat down with Nattu and treated him as a co-builder, not a search engine.
Who is Nattu? Nattu is my AI agent. He runs on OpenClaw, a multi-agent gateway I’ve been hacking on. For this post, what matters is that he held context across the whole project and pushed back when I tried to overcomplicate things.
The auth nightmare took an afternoon. We found three different public keys from my previous attempts on my Mac. None of them had a matching private key anywhere on disk. The Cloudflare tunnel that was supposed to expose my Mac to Tesla’s servers had no public hostname route configured, so the URL Tesla was supposed to fetch was timing out from the outside.
We hashed every .pem file, figured out which was which, generated a fresh keypair, fixed the tunnel, re-registered with Tesla, re-paired. End-to-end, this would have taken me weeks alone, but we got it done in under 30 minutes.
What the system actually does
What the system actually does is small.
Most days, he stays out of the way. The only proactive rule is: stop charging during peak hours, 4 PM to 9 PM. Outside of that window, if I want to charge, I charge. If I don’t, nothing happens.
On Weekends or When I’m traveling, Nattu has access to my calendar and knows when I’m returning. He knows the rules change. For example, he doesn’t do overnight charging but optimizes to charge only from solar during the day (between 10 AM and 4 PM), while keeping the Powerwall above 80%. Once he knows I’m back, he automatically reverts to the normal schedule.
Every decision Nattu makes regarding charging, he sends me a message on Telegram. “Solar surplus 4.2 kW, PW at 84%, starting at 14A.” “PW dropped to 78%, pausing.” I don’t read them live. They sit there as a log I can scroll through later.
The trip and the bug
A few weeks into having travel mode running, I had to fly out for a customer visit on short notice. Nattu saw the trip on my calendar and switched to travel mode that night.
The trip went well. The car charged from the sun, Powerwall stayed full, the bill came in lower than a normal week. I got home Tuesday night to a full battery.
Wednesday morning, the day everything was supposed to restore, I plugged the car in around 11 AM. At 11:40 the car stopped charging. I started it from the app. At 2:40 it stopped again.
Three minutes of reading logs told me the whole story. The travel script had auto-restored the normal charger correctly. It just hadn’t unloaded itself. Two scripts were running every 30 minutes, one that allowed charging, the other still enforcing the travel-mode window for a trip that had ended the day before. They kept stopping my charge.
I had built the travel mode and the restore. I’d forgotten to build the cleanup that removes the travel script from the schedule when the trip ends.
The fix was small. Unload the old job, verify it actually unloaded, alert me on Telegram if it didn’t. We added a rule to our shared notes: when you build something that hot-swaps logic, write the cleanup before you write the activation.
The Telegram log mattered here. Without it, I’d have caught the bug weeks later, squinting at a higher-than-usual power bill. With it, I caught it in three minutes by scrolling back.
Stepping back
Two things stayed with me from this.
Working with an agent is different from using AI to write or research. I’ve done a lot of that. This was different because Nattu held context across weeks of stop-and-start work. He pushed back when I tried to bolt on more rules instead of removing them. He kept me honest about whether the system was actually working or just looked like it was. The Home Assistant attempt failed because I had no one to think with. This one worked because I did.
The other thing is the list. The Tesla project sat on my list for months. I have a long list of problems like this one. Each one is solvable in theory. None of them fit into the hours I actually have.
The point of this post isn’t that you should automate your Tesla charging with an AI agent. It’s that the problems on your list that feel just out of reach probably aren’t, anymore.
Sit down with an AI agent as a partner. Start with the smallest version of what you want, and only add a rule once you’ve felt the absence of it.
Build the thing. Trust it. Verify it. In that order.
If you’re trying something similar, find me on X at @srinatar.
