Hi all,
I’d like to share a custom integration I’ve been building and refining: BatteryLabs 3-Phase.
I started this out of frustration, honestly. I was trying to figure out whether a 3-phase home battery setup would actually be worth it for my situation, and every simulation or calculator I found either assumed a naive “charge when cheap, sell when expensive” strategy, or just wasn’t transparent about why it made a given decision. I wanted something that actually modeled the hardware realistically and optimized properly not a black box, and not a greedy rule-of-thumb pretending to be smart.
It’s not a driver for physical battery hardware it’s a full software simulation of a 3-phase home battery system (Pylontech US-series + Victron MultiPlus-II), driven by your live P1 smart meter data and a dynamic energy contract. It calculates in real time what a real system should do: when to charge, when to discharge, and how deep. All based on your actual consumption and current/forecast prices.
Why I built this: I wanted to model and validate battery strategies before committing to (or upgrading) physical hardware, and existing simulation approaches I found used simple greedy heuristics (“price is high → sell”) that leave money on the table. This one doesn’t.
Core features:
Dynamic-programming 24h optimizer a mathematically optimal charge/discharge plan across the full price forecast horizon, not a rule-of-thumb. No scipyneeded, pure Python, runs in ~2 seconds.
Spread-aware arbitrage only trades aggressively when the daily price spread actually justifies the cycle wear; explicitly holds on flat-price days.
Feed-in tariff support values unused solar surplus against a separate, configurable feed-in price (fixed value or sensor-linked), so it stays useful once net-metering is phased out.
Built-in system advisor continuously compares your configured hardware against alternatives and gives concrete, numbers-backed upgrade suggestions (financial, inverter sizing, capacity, lifetime).
Realtime peak shaving with hysteresis, thermal modeling for battery + inverter, a self-learning consumption profile, and solar forecast integration.
Fails safe if the optimizer errors, it falls back to a proven heuristic automatically.
Configuration is fully UI-based (config flow + options flow), no YAML needed. Everything from hardware model to the optimizer’s “cycle budget per day” risk dial is adjustable from Settings → Devices & Services.
Requirements: 6 P1 power sensors (import/export per phase), a dynamic price sensor with hourly forecast (tested with Zonneplan) or a fixed-tariff setup, optionally a solar forecast sensor.
Repo + full README: GitHub - jkautomation01/Batterylabs · GitHub
HACS custom repository: add the URL above under Integrations.
Happy to hear feedback, questions, or ideas for what to simulate/optimize next!
The component is fully running about 80 days smooth now so very happy about that. I’m not done yet and want to improve it even more and working on some nice features to add. Stay tuned for that!
PS: I’m just starting to get the hang of HACS and GitHub, so not everything is fully set up at the minute. Please bear with me while I get everything running smoothly!
