Reference design · Automation

NEM Battery Arbitrage With Hard Limits

  • AEMO NEMweb
  • Amber API
  • Open-Meteo
  • Python
  • Home Assistant
  • Sigenergy Modbus
  • Claude Opus

The problem

A battery on the five-minute wholesale market earns money by charging and discharging at the right times. The obvious way to automate that is to let an AI model decide. A model that picks the charge window will sometimes invent a number. The battery, its warranty and the site's bill then bear the cost.

What I would build

An agent reads four inputs: AEMO dispatch and five-minute predispatch prices from NEMweb, the retailer's price feed where the customer has one, a solar forecast derived from the weather, and the battery's state of charge. A plain optimiser, not an AI model, builds a rolling charge and discharge schedule from them. The model writes only the explanation. Writes reach the inverter through Home Assistant on the Sigenergy local Modbus integration. They pass limits that no model output can move: a state-of-charge floor and ceiling, a write rate limit, a kill switch checked before anything else, dry-run by default and an audit line for every attempt. The design adds three things to the published project: a guard on cell temperature and state of health, a count of cycles against the warranty, and a staged go-live. The owner or installer approves each step out of dry-run.

The logic flow

Click any node to see what it does, what it passes on and where a person must approve.

Loading diagram...

What it returns

Each site gets a record of every write, every refused trade and every warranty cycle spent. This is a reference design on a hackathon project that runs one house and has made no live writes, so nothing here is measured on a fleet. The author's seven-day backtest used perfect foresight. It matched plain self-consumption to the cent, because export prices sat at or below zero that week.

Why it fits

An installer used to sell a commercial site owner the knowledge of when a battery should charge and when it should export. That meant knowing the tariff, the retailer's automatic mode and the setting three screens deep in the inverter app. The owner's own AI assistant can now open the AEMO price file and explain the morning's price spread in a paragraph. An installer could add a language model to the old routine and let it choose the charge window. That would hand a battery the owner has paid for in full to a component that will sometimes invent a number. When it does, the installer's name is on the warranty claim.

So this design keeps the model away from the schedule. A plain optimiser ranks charge and discharge intervals. It uses the NEMweb dispatch and five-minute predispatch prices, the retailer's feed where the customer has one, a solar forecast derived from the weather, and the measured state of charge. The model writes the two sentences that say why. Every write reaches the inverter through a local Home Assistant controller. It passes limits that no model output can move: a floor of 10% and a ceiling of 95%, ten writes an hour, a kill switch, dry-run by default and an audit line for each attempt. I would add three things to the published project: a guard on cell temperature and state of health, a count of cycles against the warranty, and a staged go-live. In the staged go-live, the owner or the installer approves each step out of dry-run. The agent never does.

A five-year strategy built on this would sell the limits, not the arbitrage. I offer that as a sketch, not a plan. Any customer can now find the price spread. The record is harder to produce, site by site: every write the battery received, every trade it declined because the export price sat below zero, and how many warranty cycles each dollar cost. An installer that keeps that record for a fleet, and lets the customer's own tools read it, is the installer a cautious assistant will recommend. The price file is public, and the audit log is not.

See it run

Want one of these?

Every part of it is open source and you can host it yourself. I bring the build, the checks around the project's gaps and the judgement about where your gates should go.