Skip to content

Commit

Permalink
fix solaredge: remove component from hierarchy (#2140)
Browse files Browse the repository at this point in the history
  • Loading branch information
LKuemmel authored Jan 13, 2025
1 parent 2fd4cd8 commit e60f24d
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions packages/modules/devices/solaredge/solaredge/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,21 @@ def get_synergy_units(component_config: Union[SolaredgeBatSetup,
SolaredgeCounterSetup,
SolaredgeInverterSetup,
SolaredgeExternalInverterSetup]) -> None:
if client.read_holding_registers(40121, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id
) == synergy_unit_identifier:
# 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")
synergy_units = int(client.read_holding_registers(
40129, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id)) or 1
log.debug(
f"Synergy Units detected for Modbus ID {component_config.configuration.modbus_id}: {synergy_units}")
else:
try:
if client.read_holding_registers(40121, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id
) == synergy_unit_identifier:
# 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")
synergy_units = int(client.read_holding_registers(
40129, modbus.ModbusDataType.UINT_16,
unit=component_config.configuration.modbus_id)) or 1
log.debug(
f"Synergy Units detected for Modbus ID {component_config.configuration.modbus_id}: {synergy_units}")
else:
synergy_units = 1
except Exception:
synergy_units = 1
return synergy_units
try:
Expand Down

0 comments on commit e60f24d

Please sign in to comment.