Schedule home battery and EV charging around solar forecasts and hourly tariffs

Remigiusz Samborski had Gemini 4 models in Antigravity build cheap-watts over a weekend, a cron job that plans battery and EV charging from solar forecasts and hourly prices and writes the inverter schedule over Modbus.

Done withGeminiinGitHubDocker· Nov 20, 2026

What they did

Samborski runs east and west facing solar panels, a hybrid inverter with a 10 kWh battery, an EV, a plug-in hybrid and a dynamic hourly tariff. Over a weekend Samborski used Google Antigravity with two models: Gemini 4 Hydrogen to draft an architecture record, a phased plan and a task list, then Gemini 4 Carbon to write the code from those files and run pytest until it passed. The result is a headless Python CLI that cron runs every 30 minutes. It reads tariffs, an Open-Meteo solar forecast and the cars' charge level, then decides whether to grid charge the battery and in which cheap hours, after any car charging window. When the inverter vendor’s cloud had no usable write API, Samborski had the agent swap in a local Modbus over TCP client behind the same interface. Branch protection, an AGENTS.md file and five CI checks (Gitleaks, Ruff, Black, pytest at 90% coverage, a Docker smoke test) gate every agent change.

How it went

Samborski says they almost never touched the code, and the project reached more than 25 commits with an offline test suite in a couple of hours of hands-on work. A stateful bug, where a later run rewrote the charging plan mid-charge, was fixed by describing the symptom to the agent, which added a locked daily plan with three unlock conditions. They ran it in dry-run mode for several days, applying its plans by hand, and reports every decision was right before switching it to live inverter writes. It now runs in Docker on a home mini PC and emails only when the plan changes.

Worth knowing

The author works on Google's developer relations team and the post promotes Antigravity and Gemini 4. Antigravity is not in our agent list, so this is tagged Gemini. The code writes registers on a grid-tied inverter, which is why a dry-run flag that reads everything but writes nothing came first. The car telematics API allowed 50 calls a day, which set the 30 minute schedule.

Try it

With Gemini· 6 parts to fill in

Build me a headless command-line tool that plans when to charge my [home battery size] battery and my [electric vehicles] from the grid. Inputs: hourly prices from [my tariff API], a solar forecast for [my roof planes and location], and car charge levels from [vehicle API]. Rules: on sunny days do not grid charge; on cloudy days buy only the deficit in the cheapest hours, and only after any car charging window. Put the inverter behind an interface, and start with a --dry-run mode that reads everything and writes nothing. Keep all credentials in a .env file and write offline tests with fixtures. Stop and show me the plan output in dry-run before writing anything to [my inverter].

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related