|
| 1 | +# SRNE Solar Controller |
| 2 | + |
| 3 | +Monitor and control SRNE ASP/ASF-series hybrid inverters via MODBUS over Solarman V5 wifi dongles. |
| 4 | + |
| 5 | +Integrates with Home Assistant through MQTT auto-discovery, providing ~65 sensor entities and 7 writable controls. Also includes a live web dashboard and CLI for direct register access. Supports multi-inverter parallel systems with aggregated data and synchronized settings writes. |
| 6 | + |
| 7 | +## Home Assistant Add-on |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +- A Solarman V5 wifi dongle (LSW-3, LSE-3, etc.) connected to your inverter |
| 12 | +- The [Mosquitto broker](https://github.com/home-assistant/addons/tree/master/mosquitto) add-on (or an external MQTT broker) |
| 13 | + |
| 14 | +### Installation |
| 15 | + |
| 16 | +Add this repository URL to your Home Assistant add-on store: |
| 17 | + |
| 18 | +``` |
| 19 | +https://github.com/daniel-sullivan/srne-solar-controller |
| 20 | +``` |
| 21 | + |
| 22 | +Install the add-on, then configure your inverter connection(s) in the add-on settings: |
| 23 | + |
| 24 | +| Option | Description | |
| 25 | +|---|---| |
| 26 | +| `inverters[].host` | IP address of the Solarman dongle | |
| 27 | +| `inverters[].port` | TCP port (default 8899) | |
| 28 | +| `inverters[].slave_id` | MODBUS slave ID (default 1) | |
| 29 | +| `inverters[].serial` | Dongle serial number (0 = auto-detect) | |
| 30 | +| `poll_interval` | Seconds between polling cycles (default 10) | |
| 31 | +| `mqtt_topic_prefix` | HA discovery prefix (default `homeassistant`) | |
| 32 | +| `mqtt_broker` | Manual broker URL override (auto-detected from Mosquitto add-on) | |
| 33 | +| `mqtt_username` | Manual broker username override | |
| 34 | +| `mqtt_password` | Manual broker password override | |
| 35 | + |
| 36 | +Start the add-on. Sensor and control entities appear automatically under the MQTT integration. |
| 37 | + |
| 38 | +### Auto-Discovered Entities |
| 39 | + |
| 40 | +**Sensors (~65 entities):** Battery SOC, voltage, current, power, temperature. PV1/PV2 voltage, current, power. Load power, apparent power, power factor. Grid voltage, current, frequency per phase (L1/L2). Inverter state, bus voltage, heatsink temperatures. Daily and lifetime energy statistics. |
| 41 | + |
| 42 | +**Controls (7 entities):** |
| 43 | + |
| 44 | +| Entity | Type | Description | |
| 45 | +|---|---|---| |
| 46 | +| Charge from Mains | Switch | Toggle grid charging. Remembers previous charger priority and restores it on OFF. | |
| 47 | +| Charger Priority | Select | CSO (PV Preferred) / CUB (Mains Preferred) / SNU (Hybrid) / OSO (PV Only) | |
| 48 | +| Output Priority | Select | SOL (Solar First) / UTI (Utility First) / SBU (Solar, Battery, Utility) | |
| 49 | +| Max Charge SOC | Number | Stop charging at this SOC (0-100%) | |
| 50 | +| Discharge Cutoff SOC | Number | Hard minimum battery SOC (0-100%) | |
| 51 | +| SOC Switch to Mains | Number | Switch to grid power below this SOC (0-100%) | |
| 52 | +| SOC Switch to Battery | Number | Switch back to battery above this SOC (0-100%) | |
| 53 | + |
| 54 | +### Web Dashboard |
| 55 | + |
| 56 | +The add-on includes a web dashboard accessible via the HA sidebar (ingress). It provides real-time monitoring with live-updating panels and a full settings editor for all inverter parameters. |
| 57 | + |
| 58 | +## Supported Hardware |
| 59 | + |
| 60 | +SRNE ASP and ASF series hybrid inverters connected via Solarman V5 wifi dongles. Communication is over TCP port 8899 using the Solarman V5 protocol wrapping MODBUS RTU. |
| 61 | + |
| 62 | +Tested with ASP48100U200-H units in split-phase 120/240V parallel configuration. |
| 63 | + |
| 64 | +## Standalone Usage |
| 65 | + |
| 66 | +The controller can also run outside Home Assistant as a standalone service or CLI tool. |
| 67 | + |
| 68 | +### Prerequisites |
| 69 | + |
| 70 | +- [mise](https://mise.jdx.dev/) (manages the Go toolchain) |
| 71 | + |
| 72 | +```sh |
| 73 | +mise install |
| 74 | +``` |
| 75 | + |
| 76 | +### Service Mode |
| 77 | + |
| 78 | +Create a `srne.toml` config file: |
| 79 | + |
| 80 | +```toml |
| 81 | +[server] |
| 82 | +poll_interval = "10s" |
| 83 | +web_port = 8080 |
| 84 | +settings_refresh = "5m" |
| 85 | + |
| 86 | +[[inverter]] |
| 87 | +host = "10.100.3.92" |
| 88 | +port = 8899 |
| 89 | +slave_id = 1 |
| 90 | + |
| 91 | +[[inverter]] |
| 92 | +host = "10.100.5.55" |
| 93 | +port = 8899 |
| 94 | +slave_id = 2 |
| 95 | + |
| 96 | +[mqtt] |
| 97 | +broker = "tcp://localhost:1883" |
| 98 | +client_id = "srne" |
| 99 | +topic_prefix = "homeassistant" |
| 100 | +``` |
| 101 | + |
| 102 | +```sh |
| 103 | +mise run serve |
| 104 | +``` |
| 105 | + |
| 106 | +The web dashboard is available at `http://localhost:8080`. The MQTT section is optional when running standalone. |
| 107 | + |
| 108 | +### CLI |
| 109 | + |
| 110 | +```sh |
| 111 | +# Display inverter product info |
| 112 | +mise exec -- go run . info --host 10.100.3.92 |
| 113 | + |
| 114 | +# Dump all register groups |
| 115 | +mise exec -- go run . dump --host 10.100.3.92 all |
| 116 | + |
| 117 | +# Dump a specific group: battery, inverter, settings, stats, faults, timed |
| 118 | +mise exec -- go run . dump --host 10.100.3.92 battery |
| 119 | + |
| 120 | +# Read specific registers |
| 121 | +mise exec -- go run . read --host 10.100.3.92 0x0100 10 |
| 122 | + |
| 123 | +# Write a register |
| 124 | +mise exec -- go run . write --host 10.100.3.92 0xE001 0x0036 |
| 125 | + |
| 126 | +# Probe for undocumented registers in a range |
| 127 | +mise exec -- go run . probe --host 10.100.3.92 0xE100 0xE150 |
| 128 | + |
| 129 | +# Passively scan dongle traffic |
| 130 | +mise exec -- go run . scan --host 10.100.3.92 |
| 131 | +``` |
| 132 | + |
| 133 | +Global flags: `--host` (required), `--port` (default 8899), `--serial` (auto-detected if omitted), `--slave` (default 1), `--debug`. |
| 134 | + |
| 135 | +### REST API |
| 136 | + |
| 137 | +| Endpoint | Method | Description | |
| 138 | +|---|---|---| |
| 139 | +| `/api/snapshot` | GET | Current system snapshot (JSON) | |
| 140 | +| `/api/snapshot/stream` | GET | SSE stream of snapshots | |
| 141 | +| `/api/settings` | GET | Current inverter settings | |
| 142 | +| `/api/settings/write` | POST | Write settings (`{"changes": [{"field": "...", "value": "..."}]}`) | |
| 143 | +| `/api/faults` | GET | Fault history records | |
| 144 | +| `/api/entities` | GET | All entity metadata (sensors + controls) with current state | |
| 145 | +| `/api/controls/{key}` | POST | Write a control value (`{"value": "..."}`) | |
| 146 | + |
| 147 | +## Architecture |
| 148 | + |
| 149 | +``` |
| 150 | +CLI/API -> modbus.Session (cache + retry) -> modbus.Client -> Solarman V5 (TCP:8899) -> MODBUS RTU -> Inverter |
| 151 | +``` |
| 152 | + |
| 153 | +| Package | Role | |
| 154 | +|---|---| |
| 155 | +| `modbus/` | MODBUS RTU framing, CRC16, `Client` interface, `Session` (register cache + exponential backoff retry) | |
| 156 | +| `interfaces/solarman/` | Solarman V5 TCP transport with serial auto-detection, interleaved response filtering, and automatic reconnection | |
| 157 | +| `interfaces/mock/` | Mock inverter and live simulator for testing | |
| 158 | +| `register/` | Register definitions, context-aware scaling (`ScaleFunc`), fault code lookup | |
| 159 | +| `inverter/` | Multi-inverter system management, typed snapshots, aggregation, settings encoding | |
| 160 | +| `serve/` | Polling hub, MQTT publisher with HA control entities, web dashboard (HTMX/SSE), REST API | |
| 161 | +| `cmd/` | Cobra CLI: `read`, `write`, `dump`, `info`, `scan`, `probe`, `serve` | |
| 162 | + |
| 163 | +## Building |
| 164 | + |
| 165 | +```sh |
| 166 | +mise exec -- go build ./... |
| 167 | +mise exec -- go test ./... |
| 168 | +``` |
| 169 | + |
| 170 | +## References |
| 171 | + |
| 172 | +- [SRNE ASP 8-10kW User Manual](https://www.srnesolar.com/userfiles/files/2025/11/28/ASP%20_8-10kW_U_All-in-one%20solar%20charge%20inverter_V1.3[20250514].pdf) |
| 173 | +- [SRNE MODBUS Protocol PDFs](https://github.com/shakthisachintha/SRNE-Hybrid-Inverter-Monitor/tree/master/Resources) |
| 174 | +- [ha-solarman](https://github.com/davidrapan/ha-solarman) -- Solarman V5 protocol implementation, SRNE inverter profile |
| 175 | +- [V2.08 Protocol + ESPHome YAML](https://github.com/phinix-org/SRNE-inverters-by-modbus-rs485) -- Latest known protocol PDF |
| 176 | + |
| 177 | +## License |
| 178 | + |
| 179 | +See [LICENSE](LICENSE) for details. |
0 commit comments