Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymodbus3 possible breaking changes #182

Closed
alexandrecuer opened this issue Oct 28, 2022 · 1 comment
Closed

pymodbus3 possible breaking changes #182

alexandrecuer opened this issue Oct 28, 2022 · 1 comment

Comments

@alexandrecuer
Copy link
Contributor

pymodbus 3 has been released

basically :

from pymodbus.client.sync import ModbusTcpClient as ModbusClient

becomes

from pymodbus.client import ModbusTcpClient as ModbusClient

and

self.rVal = self._con.read_holding_registers(register - 1, qty, unit=unitId)

becomes

self.rVal = self._con.read_holding_registers(register - 1, qty, slave=unitId)

as emonhub uses the apt packet to install pymodbus, there is no problem anyway, but if the apt packet gets updated, the code of emonhub interfacers using pymodbus should be updated

@alexandrecuer
Copy link
Contributor Author

alexandrecuer commented Feb 16, 2023

the pip package sdm_modbus now requires pymodbus >= 3.0.0

https://github.com/nmakel/sdm_modbus/blob/8b80589443f2cb18fc0d342ed0c01e90fc6ea3f8/setup.cfg#L28

when calling pip install sdm_modbus, it should remove the pymodbus version coming from apt and install a version > 3

So I think that on new or updated installs, the following interfacers should be broken :

  • EmonHubModbusRenogyInterfacer.py
  • EmonModbusTcpInterfacer.py

If it is confirmed, I can make a PR....but as I dont use these tools, a confirmation should be welcome

jkjaer added a commit to jkjaer/emonhub that referenced this issue May 17, 2024
In pymodbus-dev/pymodbus#1743, pymodbus changed
constants.Endian into being an enumeration, resulting in that
Endian.Big was changed into Endian.BIG. Moreover, the read_holding_registers methods changed the unit parameter naming into slave with pymodbus 3.0 (see openenergymonitor#182 and pymodbus-dev/pymodbus#1083).

These changes have broken the EmonModbusTcpInterfacer.py class which uses Endian.Big for both the byte and word order and the unit parameter name. This commit fixes these problems.

branches ModbusInterfacerFix
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

No branches or pull requests

1 participant