Skip to content

Deye LSW-Dongle (pysolarman)#3307

Open
ndrsnhs wants to merge 4 commits intoopenWB:masterfrom
ndrsnhs:deye-pysolarman
Open

Deye LSW-Dongle (pysolarman)#3307
ndrsnhs wants to merge 4 commits intoopenWB:masterfrom
ndrsnhs:deye-pysolarman

Conversation

@ndrsnhs
Copy link
Copy Markdown
Contributor

@ndrsnhs ndrsnhs commented Apr 20, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 pysolarmanv5 as a pinned dependency.
  • Introduce a new deye_solarman device module (device + inverter/counter/battery components).
  • Add a DeviceType enum 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
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# from modules.common.modbus import ModbusDataType

Copilot uses AI. Check for mistakes.
class DeyeSolarmanConfiguration:
def __init__(self,
ip_address: Optional[str] = None,
serial: int = None,
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
serial: int = None,
serial: Optional[int] = None,

Copilot uses AI. Check for mistakes.
powers = [0]*3
currents = [0]*3
voltages = [0]*3
power = [0]
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
power = [0]
power = 0

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants