This repository contains a small local controller for Solplanet battery/inverter systems on Amber Electric pricing.
It exists for a specific use case: you want battery behavior to respond to Amber price signals, but you do not want to depend on Home Assistant or a larger automation stack to do it.
- Heavily inspired by Home Assistant Integration - I was having trouble with HACS so wrote my own.
Solplanet exposes a local HTTP API, and Amber exposes current price and tariff metadata, but there is no simple built-in controller that ties the two together for:
- charging on very cheap import pricing
- discharging on favorable feed-in pricing
- respecting demand windows
- keeping battery SOC within practical bounds
- failing safely when communications are unreliable
This repository is that controller.
On each loop, the controller:
- reads battery telemetry from the local Solplanet API
- reads current Amber price intervals
- decides whether to
charge,discharge, orfallback - applies that decision using the local Solplanet control API
The fallback action is self-consumption mode.
The controller is intentionally simple and conservative.
It uses:
- Amber general pricing to decide when charging is allowed
- Amber feed-in pricing to decide when discharge/export is attractive
- battery SOC guards to stop charge/discharge outside configured bounds
- high-SOC price guards so charging above 70% SOC only happens when import pricing is below 5 c/kWh by default
- demand-window guards so charge windows do not run into the daily demand period
- short, backdated schedule windows so stale commands naturally expire quickly if comms fail
That last point matters: this project is designed around the reality that inverter control can be unreliable. The scheduling strategy reduces the blast radius of missed updates.
If you have the same ingredients:
- Solplanet inverter with local API access
- Amber Electric pricing
- interest in battery arbitrage or price-aware battery control
then this repository gives you a working starting point for local control without having to reverse-engineer the Solplanet control path from scratch.
The controller reads local configuration from .env:
SOLPLANET_HOSTSOLPLANET_BATTERY_SNAMBER_SITE_IDAMBER_API_KEY
See .env.example.
Useful CLI tuning knobs:
--charge-target-socdefault97--discharge-target-socdefault40--high-soc-charge-thresholddefault70--high-soc-cheap-pricedefault5.0
Runtime logs are written as NDJSON so the output can be analysed later for controller behavior and battery/arbitrage history.
Typical event types include:
battery_statedecisiondry_runappliederror
Install dependencies:
make installCheck the script:
make checkRun the live controller loop:
make runRun it without applying changes:
make dry-run