Files
2026-04-20 13:53:57 +02:00

120 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Growatt ShineLAN-X — Custom Firmware
Custom-Firmware für den **Growatt ShineLAN-X** LAN-Stick. Liest Modbus RTU vom Wechselrichter und publiziert alle Werte per **MQTT** direkt in Home Assistant — vollständig lokal, ohne Growatt-Cloud.
---
## Hardware
| Komponente | Details |
|---|---|
| MCU | STM32F103RBT6 (LQFP-64) |
| Ethernet | ENC28J60 (Bitbang SPI2 auf PB12PB15) |
| Wechselrichter-Anbindung | USB-CDC (virtueller COM-Port, 115200 Baud) |
| Programmier-Interface | SWD via ST-Link |
### Pin-Belegung (vollständig verifiziert)
Quelle: [mwalle/shinelanx-modbus](https://github.com/mwalle/shinelanx-modbus) — identische Platine.
| Funktion | Pin | Hinweis |
|---|---|---|
| ETH CS | PB12 | SPI2 NSS |
| ETH SCK | PB13 | SPI2 SCK |
| ETH MISO | PB14 | SPI2 MISO |
| ETH MOSI | PB15 | SPI2 MOSI |
| ETH RST | PC8 | |
| ETH INT | PC6 | optional |
| USB D- | PA11 | Wechselrichter-Kommunikation |
| USB D+ | PA12 | Wechselrichter-Kommunikation |
| USB Pullup | PA8 | |
| Debug UART TX | PA9 | USART1, 115200 |
| Debug UART RX | PA10 | USART1, 115200 |
| LED Debug | PC7 | aktiv LOW |
| LED Rot | PB1 | aktiv LOW |
| LED Grün | PB0 | aktiv LOW |
| LED Blau | PC5 | aktiv LOW |
| Taster | PA3 | aktiv LOW |
### SWD-Verkabelung (Flashen)
| ShineLAN-X Testpunkt | ST-Link V2 |
|---|---|
| SWDIO | SWDIO |
| SWDCLK | SWCLK |
| GND | GND |
| 3.3V | 3.3V (nur wenn nicht extern versorgt) |
---
## Konfiguration
Alle Einstellungen in `firmware/include/config.h`:
```cpp
// DHCP (1) oder statische IP (0)
#define USE_DHCP 1
// MQTT-Broker
#define MQTT_BROKER "192.168.1.1"
#define MQTT_USER "mqtt"
#define MQTT_PASSWORD "..."
// Modbus Slave-Adresse (Standard: 1)
#define MODBUS_ADDR 1
```
---
## Flashen
```bash
cd firmware
pio run --target upload
```
---
## Wechselrichter-Kompatibilität
Die Sensor-Liste in `main.cpp` entspricht dem **Growatt SPH 5000 TL3-BH-UP** (dreiphasig, mit Batterie).
Beim Testen mit dem **MIC 1500 TL-X** (einphasig, ohne Batterie):
| Unterschied | MIC 1500 | SPH 5000 |
|---|---|---|
| AC Output Power | Register **40** | Register 35 |
| PV-Strings | nur PV1 | PV1 + PV2 |
| Phasen | nur L1 | L1 / L2 / L3 |
| Batterie-Register | nicht vorhanden | 10091058 |
Nicht vorhandene Register werden automatisch übersprungen (kein Absturz). Für Dauerbetrieb am MIC 1500 einfach die nicht passenden Sensoren in `main.cpp` auskommentieren und `ac_power_total` auf Register 40 ändern.
---
## MQTT Topics
Nach dem Start sendet die Firmware automatisch **MQTT Discovery** — Home Assistant erkennt das Gerät ohne manuelle Konfiguration.
| Topic | Inhalt |
|---|---|
| `homeassistant/sensor/growatt_shinelan_*/config` | Discovery (retained) |
| `growatt/shinelan/pv1_power` | PV1 Leistung in W |
| `growatt/shinelan/ac_power_total` | AC Ausgangsleistung in W |
| `growatt/shinelan/energy_today` | Tagesenergie in kWh |
| `growatt/shinelan/energy_total` | Gesamtenergie in kWh |
| `growatt/shinelan/bat_soc` | Batterie Ladestand in % |
| `growatt/shinelan/energy_import_total` | Netzbezug gesamt in kWh |
---
## LED-Status
| LED | Bedeutung |
|---|---|
| Alle 3 kurz an | Startup |
| Grün | MQTT verbunden |
| Rot | MQTT-Verbindungsfehler |
| Debug (PC7) | Ethernet Link UP |
| Blau blinkt | Modbus-Abfrage läuft |