Skip to content

Commit

Permalink
SolarEdge: Use synergy units of the inverter to which the meters are …
Browse files Browse the repository at this point in the history
…connected (openWB#1877)

* process synergy units for inverter components

* modify test

* Use of synergy units of the inverters to which the meters are connected

* comment

---------

Co-authored-by: LKuemmel <[email protected]>
  • Loading branch information
benderl and LKuemmel authored Sep 16, 2024
1 parent 6f57ab3 commit a5a5492
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/modules/devices/solaredge/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def __init__(self, device_config: Union[Dict, Solaredge]) -> None:
self.device_config.configuration.port,
reconnect_delay=reconnect_delay)
self.inverter_counter = 0
self.synergy_units = 1
except Exception:
log.exception("Fehler im Modul "+self.device_config.name)

Expand Down Expand Up @@ -88,16 +87,18 @@ def add_component(self,
# except Exception as e:
# log.exception("Fehler beim Auslesen der Modbus-Register: " + str(e))
# pass
if self.client.read_holding_registers(40121, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id
) == synergy_unit_identifier:
if (self.client.read_holding_registers(40121, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id
) == synergy_unit_identifier and
(component_type == "external_inverter" or component_type == "counter")):
# Snyergy-Units vom Haupt-WR des angeschlossenen Meters ermitteln. Es kann mehrere Haupt-WR mit
# # unterschiedlichen Modbus-IDs im Verbund geben.
log.debug("Synergy Units supported")
self.synergy_units = int(self.client.read_holding_registers(
synergy_units = int(self.client.read_holding_registers(
40129, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id)) or 1
log.debug("Synergy Units detected: %s", self.synergy_units)
if component_type == "external_inverter" or component_type == "counter" or component_type == "inverter":
self.set_component_registers(self.components.values(), self.synergy_units)
log.debug("Synergy Units detected: %s", synergy_units)
self.set_component_registers(self.components.values(), synergy_units)
else:
raise Exception(
"illegal component type " + component_type + ". Allowed values: " +
Expand Down

0 comments on commit a5a5492

Please sign in to comment.