-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Versions
- Python: 3.9.14
- OS: Ubuntu 22.04LTS
- Pymodbus: 3.2.0
- Modbus Hardware (if used): N/A
Pymodbus Specific
- Server: N/A
- Client: N/A
Description
I'm upgrading some code from 2.5.3 to 3.x and bumped into this bug. Looks like when units were added, they were not prepared for units coming in as kwargs, resulting in
Traceback (most recent call last):
File "/home/john/workspace/collection/modbus/test.py", line 5, in <module>
client.read_holding_registers(address=0, unit='VAH', count=1)
File "/home/john/.pyenv/versions/3.9.14/envs/collection-modbus/lib/python3.9/site-packages/pymodbus/client/mixin.py", line 104, in read_holding_registers
pdu_reg_read.ReadHoldingRegistersRequest(address, count, slave, **kwargs)
TypeError: __init__() got multiple values for argument 'unit'
read_holding_registers does not expose unit as an explicit argument so kwargs is the only option. Similar problems look like they exist in most of the functions in the client/mixin.py.
It's also totally possible that I'm doing something wrong, my Python isn't that great.
Code and Logs
from pymodbus.client import AsyncModbusTcpClient
client = AsyncModbusTcpClient(host='localhost', port=502)
client.connect()
client.read_holding_registers(address=0, unit='VAH', count=1)Metadata
Metadata
Assignees
Labels
No labels