Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/modules/devices/sma/sma_sunny_boy/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class KwargsDict(TypedDict):


class SmaSunnyBoyInverter(AbstractInverter):

SMA_INT32_NAN = -0x80000000 # SMA uses this value to represent NaN
SMA_UINT32_NAN = 0xFFFFFFFF # SMA uses this value to represent NaN
SMA_NAN = -0xC000
SMA_INT16_NAN = -0x8000
SMA_INT32_NAN = -0x80000000
SMA_UINT32_NAN = 0xFFFFFFFF
SMA_UINT64_NAN = 0xFFFFFFFFFFFFFFFF

def __init__(self,
component_config: SmaSunnyBoyInverterSetup,
Expand Down Expand Up @@ -75,11 +75,14 @@ def update(self) -> None:
currents = [(power_total / 3 / 230)] * 3
else:
raise ValueError("Unbekannte Version "+str(self.component_config.configuration.version))
if power_total == self.SMA_INT32_NAN or power_total == self.SMA_NAN:

# WR geht nachts in Standby und gibt einen NaN-Wert für die Leistung aus.
if power_total in (self.SMA_INT16_NAN, self.SMA_INT32_NAN,
-self.SMA_INT16_NAN * 10, -self.SMA_INT32_NAN):
power_total = 0
# WR geht nachts in Standby und gibt einen NaN-Wert für die Leistung aus.
dc_power = 0
currents = [0, 0, 0]
Comment on lines +79 to 84
if energy == self.SMA_UINT32_NAN:
if energy in (self.SMA_UINT32_NAN, self.SMA_UINT32_NAN * 100, self.SMA_UINT64_NAN):
raise ValueError(
f'Wechselrichter lieferte nicht plausiblen Zählerstand: {energy}. '
'Sobald PV Ertrag vorhanden ist sollte sich dieser Wert ändern, '
Expand Down