Load manager for hybrid solar inverters. A master node reads the inverter over read-only Modbus, estimates the battery state of charge and decides what each SmartRele relay does according to configurable rules, to stretch the battery through grid outages and make the most of solar energy.
| Status | main: v0.2.7, piloted on a home installation. v0.3.6 (ESP-NOW relay link, relay OTA, Telegram roles) in #15 |
| Deployments | Home pilot (ECO-LV 3.6 kW, 24 V LiFePO4). Sold to a client: Bluesun SPI-10K-UP installation with four freezers |
| Master | Wemos D1 Mini (ESP8266); product target ESP32-S3 |
| Tests | Core logic unit-tested on the host (pio test -e native); firmware and tools built in CI on every push |
- Reads the inverter, never writes to it. Only Modbus functions
0x03/0x04can be built; any other function is rejected inbuildRead()(lib/inverter/modbus_ro.h) and a self-test checks it on every boot. - Estimates SOC without a communicating BMS. The inverter reports 100 % at 26.2 V (~40 % real), so LoadPilot counts charge from the inverter current, corrects it with the resting voltage and resets to 100 % when full.
- Rule engine per relay: templates (e.g. essential load with rationing), on/off duty cycles for normal and austerity modes, SOC thresholds with hysteresis, battery cut-off and time windows without grid, a critical-SOC cut and a total power limit with staggered switching.
- Grid-return guarantee: grid presence is confirmed from two independent signals; when it changes, manual overrides are cleared and the rules take over again, so a load always comes back on with the grid.
- Works without internet. Local web UI (status, relays, 7-day history charts, events, settings, firmware update) served by the master; internet only adds NTP time and a Telegram bot with remote status and OTA.
- Fits an ESP8266: history stored in flash blocks, TLS for Telegram with ~12 KB of free heap, boot guard and safe mode.
lib/core/ portable C++ (no Arduino): config, SOC estimator, rules, safety, reconciler, history, web API
lib/sim/ simulated inverter and relays, to test the logic without hardware
lib/inverter/ Arduino drivers: SumryDriver + read-only Modbus RTU
lib/relay/ SmartRele HTTP client with digest auth
lib/platform/ persistence (LittleFS), Telegram bot, boot guard, log buffer
src/app/ master firmware
src/tools/ bench tools: Modbus scanner, CSV register dump, web panel, relay tester
test/ host unit tests (Unity)
docs/ plan, architecture, decision records (adr/), inverter protocol, wiring
The control core is plain C++ behind swappable interfaces (InverterDriver, RelayLink), so the same logic runs
against the real inverter, the simulator and the unit tests. Design decisions are recorded as ADRs in
docs/adr/.
| Part | Model |
|---|---|
| Inverter | ECO-LV 3.6KW PLUS (Sumry/PowMr family), 24 V, 120 V output, RJ45 "RS232" port |
| Battery | WattCycle LiFePO4 24 V 100 Ah (no communicating BMS) |
| Master | Wemos D1 Mini (ESP8266) |
| Interface | MAX3232 module at 3.3 V |
| Relays | SmartRele (ESP-12F, REST API) |
Wiring in docs/hardware.md; protocol and register map in docs/inverters/sumry.md.
Copy include/secrets.example.h to include/secrets.h, fill it in and adjust data/config.json. Then:
pio run -e d1mini -t uploadfs
pio run -e d1mini -t upload| PlatformIO environment | Purpose |
|---|---|
d1mini |
Master with the real inverter (default) |
d1mini_ota |
Master over OTA (LOADPILOT_OTA_PASS in the environment) |
d1mini_sim |
Master with the simulated inverter |
tools_scanner |
Finds the Modbus baud rate and slave address |
tools_dump |
Dumps registers to CSV |
tools_panel / tools_panel_sim |
Stand-alone web panel (Wi-Fi Inversor-Panel → http://192.168.4.1) |
tools_relay |
Exercises one SmartRele from the serial console |
native |
Core unit tests on the host |
Web UI at http://<master>/ (user admin, password LP_ADMIN_PASS). To try the UI without a board:
python scripts/mock_api.py, then open http://localhost:8765.
Telegram (optional): create a bot with @BotFather and set LP_TG_TOKEN. Message the bot; the master logs your
chat id at http://<master>/log; authorize it in Settings → Connection.
Host tests need gcc (on Windows, MSYS2):
pio test -e nativeThe detailed documentation is written in Spanish, the language of the installations it was built for: installation and user guide · home pilot · project plan · architecture · decision records · Sumry/PowMr protocol · wiring · changelog.
MIT.