Immanuel Lam
An autonomous agent that re-plans a 64 kWh Sigenergy battery's charge/discharge schedule every 30 minutes against live AEMO wholesale prices, BOM weather forecasts, and Home Assistant sensor data.
Core trick
Re-plans a home battery's charge schedule every 30 minutes from live wholesale prices and weather forecasts, with Claude writing a rationale for each plan change.
Description
An autonomous agent that re-plans a 64 kWh Sigenergy battery's charge/discharge schedule every 30 minutes against live AEMO wholesale prices, BOM weather forecasts, and Home Assistant sensor data. Every time the plan changes, Opus 4.7 writes a two-sentence rationale explaining what shifted and why. Backtest over 7 days of real household data: agent beat Amber SmartShift's actual dispatch by $5.91/day — by correctly refusing to export when NSW1 prices were negative all week. The win is knowing when not to act.
README excerpt
# Sigenergy NEM Arbitrage Agent Autonomous agent that plans battery charge/discharge against live AEMO wholesale prices. Built for the Built with Opus 4.7 hackathon (Cerebral Valley, submission deadline 2026-04-26 8 PM EST). Runs on exactly one house: Immanuel's place in Sydney, with a 64 kWh Sigenergy LFP pack, 2× Sigen inverters, and 24 kWp of solar on an Amber Electric tariff. Licensed MIT. Backend (Python), frontend (Next.js), data, and prompts are all in this repo. Repo: [github.com/immanuel-lam/sigenergy-nem-arb](https://github.com/immanuel-lam/sigenergy-nem-arb) ## What it does Every 30 minutes the agent runs a cycle: 1. **Ingest** — AEMO 5MPD prices (NSW1), Open-Meteo cloud and irradiance forecast, HA sensors for SOC, load, solar, battery power. Amber API if the key is set. 2. **Forecast** — 48h load from day-of-week rolling average over HA history; 48h solar from clear-sky × cloud derating. 3. **Schedule** — greedy rank-and-fill. Enumerates (charge, discharge) interval pairs, sorts by `(spread × RTE − cycle_cost)`, assigns energy under SOC bounds and rate caps. 4. **Diff + audit** — structured diff of new plan vs the last one; audits how far actual SOC drifted from what the previous plan expected. 5. **Explain** — Opus 4.7 writes two sentences of rationale quoting the specific prices and SOC. 6. **Actuate** — writes the current interval's setpoint through the Sigenergy HA integration (`select.plant_remote_ems_control_mode` + charge/discharge limits). Dry-run by