Amber wholesale energy optimiser for a Sigenergy hybrid inverter with ~13 kW solar and a 40 kWh battery. Solves a stochastic MILP (PuLP + HiGHS) over 5-min slots across the priced Amber forecast horizon, applies the slot-0 decision to the inverter via Modbus, and verifies behaviour against a 10-second post-write watcher.
An external dead-man watchdog sidecar enforces a safe state if the main service stops ticking — the Sigenergy firmware has no Modbus communication watchdog of its own (verified against live hardware; see KNOWN-ISSUES #0d).
Co-optimises battery dispatch with a Shelly-relayed Haier HP330M1-U1 hot water heat pump in PV mode.
- Python 3.12 (pinned via
.python-version) - uv for dependency management
- Docker + Docker Compose for deploy (watchdog sidecar depends on compose)
uv sync # install the project + dev group
uv run pytest tests/ -q # full test suitecp config.example.toml config.toml # fill in secrets
uv run eo-smoke -c config.toml --offline # synthetic LP solve, no networkRun each smoke phase against live hardware and confirm clean output before moving to the next:
uv run eo-smoke -c config.toml --offline # zero risk
uv run eo-smoke -c config.toml --modbus-read # read-only Modbus probe
uv run eo-smoke -c config.toml --api-probe # 1 call per API (costs 1 Solcast quota)
uv run eo-smoke -c config.toml --dry-tick # full tick, prints proposed writes, no actuationsOnce all four are clean, bring up the stack:
docker compose up -d # runs both the service and the watchdog sidecarFor boot-time autostart, install the systemd unit — see DEPLOY.md.
uv run eo-replay \
-s '/var/lib/energy-optimiser/snapshots/2026-*.ndjson.gz' \
-c candidate-config.toml \
-o results.ndjson -vCompares a candidate LP configuration against historical snapshot ticks.
energy-optimiser— the service (tick loop + wake loops)eo-smoke— read-only pre-deploy smoke testseo-replay— replay historical ticks against a candidate configeo-watchdog— dead-man sidecar; pins the inverter to an explicit safe state if the main service stops ticking
CLAUDE.md— development guide (architecture, conventions, testing)SPEC-ENERGY-01.md— authoritative spec (design decisions, register map, acceptance criteria)DEPLOY.md— first-deployment runbookKNOWN-ISSUES.md— open issues and resolution history