Skip to content

Fix rtutcp initialization for pymodbus 3.x (remove deprecated method kwarg) - #1

Open
richardapeters wants to merge 1 commit into
Developer089:mainfrom
richardapeters:features/rtutcp-serialclient-method-kwarg
Open

richardapeters wants to merge 1 commit into
Developer089:mainfrom
richardapeters:features/rtutcp-serialclient-method-kwarg

Conversation

@richardapeters

Copy link
Copy Markdown

Summary

Fixes RTU-over-TCP setup failure caused by passing method="rtu" to AsyncModbusSerialClient, which is not accepted in newer pymodbus versions.

Problem

Users configuring rtutcp hit:
AsyncModbusSerialClient.init() got an unexpected keyword argument 'method'

The integration currently sets:

  • method: "rtu"
  • port: "socket://:"

In current pymodbus APIs, AsyncModbusSerialClient already implies RTU framing, so method is unnecessary and invalid.

Change

In custom_components/deye_modbus/coordinator.py:

  • Removed "method": "rtu" from params passed to AsyncModbusSerialClient.
  • Kept port="socket://host:port" and serial params unchanged.

Why this works

AsyncModbusSerialClient determines RTU behavior by client type.
socket://... selects socket transport for serial-style RTU frames (RTU-over-TCP tunnel).

Impact

  • Fixes startup/setup error for rtutcp on newer pymodbus.
  • No behavior change for standard TCP path.

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.

1 participant