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
+12 -5
View File
@@ -1,4 +1,5 @@
import logging
import struct
import time
from typing import Dict, Optional
@@ -66,12 +67,18 @@ def _extract_sensors(sensors: list, regs: Dict[int, int]) -> Dict[str, float]:
if s.reg not in regs:
log.warning("Register %d fehlt in Antwort (%s)", s.reg, s.id)
continue
if s.count == 2:
data_type = getattr(s, "data_type", "uint16")
if data_type == "float32":
if s.reg + 1 not in regs:
log.warning("Register %d (high word) fehlt (%s)", s.reg + 1, s.id)
log.warning("Register %d+1 fehlt (%s)", s.reg, s.id)
continue
raw = (regs[s.reg] << 16) | regs[s.reg + 1]
raw_val = struct.unpack(">f", struct.pack(">HH", regs[s.reg], regs[s.reg + 1]))[0]
elif s.count == 2:
if s.reg + 1 not in regs:
log.warning("Register %d+1 fehlt (%s)", s.reg, s.id)
continue
raw_val = ((regs[s.reg] << 16) | regs[s.reg + 1]) * s.scale
else:
raw = regs[s.reg]
values[s.id] = round(raw * s.scale, 3)
raw_val = regs[s.reg] * s.scale
values[s.id] = round(raw_val, 3)
return values