Feature: Eastron SDM-630 Support + Float32 Decode (v1.1.5)

- inverters.py: data_type Feld in Sensor (uint16/uint32/float32)
  + SDM-630 Definition (16 Sensoren: U/I/P L1-L3, PF, Freq, kWh)
  + read_ranges: [(0, 76)] — alle Sensoren in einem Batch
- modbus_client.py: Float32 IEEE 754 Decode via struct.unpack
  (SDM-630 liefert Floats, Growatt liefert skalierte Integer)
- index.html: "Wechselrichter" → "Gerät" — Add-on unterstützt
  jetzt beliebige Modbus-Geräte, nicht nur Wechselrichter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
retr0
2026-04-26 17:07:14 +02:00
parent fd5625b99a
commit 33c6a15644
4 changed files with 54 additions and 17 deletions
+31 -1
View File
@@ -7,12 +7,13 @@ class Sensor:
id: str
name: str
reg: int
count: int # 1 = uint16, 2 = uint32 (high word first)
count: int # number of 16-bit registers (1 or 2)
scale: float
unit: str
device_class: Optional[str]
state_class: str
icon: str
data_type: str = "uint16" # "uint16", "uint32", "float32"
@dataclass
@@ -95,6 +96,28 @@ def _mod_sensors() -> List[Sensor]:
]
def _sdm630_sensors() -> List[Sensor]:
f = "float32"
return [
Sensor("voltage_l1", "Spannung L1", 0, 2, 1.0, "V", "voltage", "measurement", "mdi:flash", f),
Sensor("voltage_l2", "Spannung L2", 2, 2, 1.0, "V", "voltage", "measurement", "mdi:flash", f),
Sensor("voltage_l3", "Spannung L3", 4, 2, 1.0, "V", "voltage", "measurement", "mdi:flash", f),
Sensor("current_l1", "Strom L1", 6, 2, 1.0, "A", "current", "measurement", "mdi:flash", f),
Sensor("current_l2", "Strom L2", 8, 2, 1.0, "A", "current", "measurement", "mdi:flash", f),
Sensor("current_l3", "Strom L3", 10, 2, 1.0, "A", "current", "measurement", "mdi:flash", f),
Sensor("power_l1", "Wirkleistung L1", 12, 2, 1.0, "W", "power", "measurement", "mdi:flash", f),
Sensor("power_l2", "Wirkleistung L2", 14, 2, 1.0, "W", "power", "measurement", "mdi:flash", f),
Sensor("power_l3", "Wirkleistung L3", 16, 2, 1.0, "W", "power", "measurement", "mdi:flash", f),
Sensor("power_factor_l1", "Leistungsfaktor L1", 30, 2, 1.0, "", None, "measurement", "mdi:sine-wave", f),
Sensor("power_factor_l2", "Leistungsfaktor L2", 32, 2, 1.0, "", None, "measurement", "mdi:sine-wave", f),
Sensor("power_factor_l3", "Leistungsfaktor L3", 34, 2, 1.0, "", None, "measurement", "mdi:sine-wave", f),
Sensor("total_power", "Gesamtwirkleistung", 48, 2, 1.0, "W", "power", "measurement", "mdi:transmission-tower", f),
Sensor("frequency", "Frequenz", 70, 2, 1.0, "Hz", "frequency", "measurement", "mdi:sine-wave", f),
Sensor("import_kwh", "Bezug Gesamt", 72, 2, 1.0, "kWh", "energy", "total_increasing", "mdi:transmission-tower-import", f),
Sensor("export_kwh", "Einspeisung Gesamt", 74, 2, 1.0, "kWh", "energy", "total_increasing", "mdi:transmission-tower-export", f),
]
INVERTERS = {
"MIC_1500_TL_X": Inverter(
id="MIC_1500_TL_X",
@@ -124,4 +147,11 @@ INVERTERS = {
sensors=_mod_sensors(),
read_ranges=[(3, 91), (93, 1)],
),
"SDM_630": Inverter(
id="SDM_630",
name="Eastron SDM-630",
manufacturer="Eastron",
sensors=_sdm630_sensors(),
read_ranges=[(0, 76)], # regs 0-75, alle 16 Sensoren
),
}