openenergymonitor / emonhub

Python service linking and decoding input to MQTT & Emoncms
90 stars 83 forks source link

Change Endian.Big to Endian.BIG as per pymodbus change #213

Closed jkjaer closed 6 months ago

jkjaer commented 6 months ago

In https://github.com/pymodbus-dev/pymodbus/pull/1743, pymodbus changed constants.Endian into being an enumeration, resulting in that Endian.Big was changed into Endian.BIG. Unfortunately, this change has broken the EmonModbusTcpInterfacer class which uses Endian.Big for both the byte and word order when calling BinaryPayloadDecoder.fromRegisters (also from pymodbus).

To fix the problem, Endian.Big should be changed to Endian.BIG in EmonModbusTcpInterfacer.py.

jkjaer commented 6 months ago

I have already fixed the problem on a new branch on a local copy of the emonhub repository. However, I do not have access rights to push this fix to here. Is there a procedure for getting such access rights or do you prefer to apply the fix yourself?

alexandrecuer commented 6 months ago

@jkjaer : the procedure is to make a pull request, you fork the repo into your github account, then make the mods and then open a PR.

there is also other small things to correct : read_holding_registers(register - 1, qty, unit=unitId) should be read_holding_registers(register - 1, qty, slave=unitId) since pymodbus3

cf https://github.com/openenergymonitor/emonhub/issues/182

tell me if you are OK for the PR, otherwise I will do it

jkjaer commented 6 months ago

@alexandrecuer Thanks for the clarification. I will implement the two fixes and open a PR.

alexandrecuer commented 6 months ago

@jkjaer : thanks for the PR 👍

jkjaer commented 6 months ago

No problem. Glad to contribute :)