Been running this at home for a month and finally cleaned it up into a blueprint.
What it does: it’s the decision layer. It watches your dynamic price sensor
and decides CHARGE / DISCHARGE / IDLE. You wire your own battery’s control into
three action inputs, so it works with any battery — Anker Solix, Marstek, Victron,
Sonnen, whatever you can already control from HA. The brain decides, your actions
execute.
I split it that way because every battery integration is different, but the logic
is always the same. This way nobody has to fork it for their hardware.
Inputs
- Price sensor (Nord Pool, Tibber, aWATTar, EPEX, …)
- Cheap threshold — charge at or below this price
- Expensive threshold — discharge at or above
- Battery SoC sensor (optional — leave empty to skip the guards)
- Stop charging above X % (default 95)
- Keep a reserve, don’t discharge below X % (default 20)
- Charge / discharge / idle actions
The gap between the two thresholds is a neutral band on purpose. Without it the
automation flaps every time the price sits right on the line. Triggers on price
change and every 5 minutes.
Honest caveat: this only makes sense on an hourly/dynamic tariff. On a flat
rate there’s nothing to arbitrage and the battery won’t pay for itself. Solar
helps but isn’t required.
Real numbers from my own setup (Germany, balcony solar + one small battery):
15.67 EUR last week, about 2.50 a day. Not spectacular, but it’s fully hands-off.
Feedback on the logic welcome — especially from anyone running a battery I haven’t
tested against.