pythonpython-3.xpymodbuspymodbus3

Read RTU Pymodbus data through TCP/Forwarder


I have Energy Meter connected through RTU and i am able to get holding registers data through simple RTU Code. Now i want to make Convert this RTU to TCP through Forwarder. I want to send data to TCP which forwards the command to RTU and fetches data of RTU connected device for me.

I have implement the Forwarder code just dont know how to fetch the holding register of RTU through it.


Solution

  • If you are working with real device, make sure you are explicitly initialising the remote slave context with the unit Id.

    context = RemoteSlaveContext(serial_client, unit=<unit-id-of-slave>)

    The default is 0 which works fine with simulated slaves but would be considered as a broadcast address with the real devices generally and no response would be returned back.