Search code examples
pythondockermodbuspymodbustcpwago

pyModbusTCP timeout inside Docker container


I have a similar issue like here. But effect the effect is limited to pyModbusTCP inside a Docker container and a WAGO 750-8000.

I initialize the Modbus client by inside a Docker container:

mc = ModbusClient(host="192.168.100.1", port=502, debug=True, timeout=0.1)

When I'm trying to read the registers with:

mc.read_holding_registers(256, 50)

I'm getting a timeout error:

Tx
[B9 AE 00 00 00 06 01] 03 01 00 00 32
timeout error

If i increase the timout (to 0.7 or higher) it works. At least sometimes.

The interesting thing is, if I do the same Python Code on the host machine (Windows 10), then it works, even with a very short timeout of 0.01s.

Also: With a different Modbus device (an older WAGO 750-832) it works (out of docker container).

Any ideas, which component may be configured wrong?


Solution

  • So things had nothing to do with the mentioned libs and software. Problem was a bug in WAGO 750-8000 Modbus implementation. Fix comes with a firmware update.