Deye LSW-Dongle (pysolarman)#3307
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for the Deye LSW (WiFi) dongle variant that communicates via the proprietary “pysolarman” protocol (via pysolarmanv5), by introducing a new deye_solarman device implementation alongside the existing deye Modbus device.
Changes:
- Add
pysolarmanv5as a pinned dependency. - Introduce a new
deye_solarmandevice module (device + inverter/counter/battery components). - Add a
DeviceTypeenum used to branch register mappings by inverter model type.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Adds pysolarmanv5 dependency needed for LSW dongle communications. |
| packages/modules/devices/deye/deye_solarman/device.py | Wires up PySolarmanV5 client creation and component update loop for the new device type. |
| packages/modules/devices/deye/deye_solarman/config.py | Adds configuration objects for the new device type (IP/serial/port/modbus_id) and component setup shells. |
| packages/modules/devices/deye/deye_solarman/device_type.py | Defines supported device type IDs used by component logic. |
| packages/modules/devices/deye/deye_solarman/inverter.py | Implements inverter power reading via Solarman client registers. |
| packages/modules/devices/deye/deye_solarman/counter.py | Implements counter readings (currents/voltages/power/frequency) via Solarman registers. |
| packages/modules/devices/deye/deye_solarman/bat.py | Implements battery power/SOC readings via Solarman registers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from modules.common.component_state import CounterState | ||
| from modules.common.component_type import ComponentDescriptor | ||
| from modules.common.fault_state import ComponentInfo, FaultState | ||
| # from modules.common.modbus import ModbusDataType |
There was a problem hiding this comment.
There is a commented-out import (# from modules.common.modbus import ModbusDataType) left in the file. Please remove it to avoid dead code and keep the module clean.
| # from modules.common.modbus import ModbusDataType |
| class DeyeSolarmanConfiguration: | ||
| def __init__(self, | ||
| ip_address: Optional[str] = None, | ||
| serial: int = None, |
There was a problem hiding this comment.
serial is annotated as int but defaults to None. This is inconsistent with the type hint and makes static analysis / IDE assistance inaccurate. Consider changing it to Optional[int] (and/or validating that a serial is provided before creating the client).
| serial: int = None, | |
| serial: Optional[int] = None, |
| powers = [0]*3 | ||
| currents = [0]*3 | ||
| voltages = [0]*3 | ||
| power = [0] |
There was a problem hiding this comment.
In the SINGLE_PHASE_HYBRID branch, power is set to a list ([0]). PeakFilter.check_values(power) and SimCounter.sim_count(power) expect a numeric (float/int) and will raise a TypeError when this device type is detected. Use a numeric 0 (or compute a scalar power) instead of a list.
| power = [0] | |
| power = 0 |
UI: openWB/openwb-ui-settings#963
Ticket #66002706
Deye bietet 2 unterschiedliche Dongles für die Modbus Kommunikation an: LSW (Wifi) und LSE (Lan).
Der LSW nutzt das proprietäre Pysolarman Protokoll - ist ansonsten aber identisch.
Zur Kommunikation wird folgendes Modul genutzt:
https://github.com/jmccrohan/pysolarmanv5