I have a running Modbus TCP server on a PLC with these parameters:
- IP: 192.168.1.10
- Port: 502
- Device address: 1
- Holding register on address 1 with heartbeat variable
I know for sure that the Modbus TCP server is running because I have tried connecting to it via Python script sucesfully:
from pyModbusTCP.client import ModbusClient
host = '192.168.1.10'
port = 502
client = ModbusClient(host, port, unit_id = 1)
client.open()
hr = client.read_holding_registers(0,10)
print(hr)
Output:
[310, 0, 0, 0, 0, 0, 0, 0, 0, 0]
My Node-red gets stuck in registered state always:
When I force it to connect it sends out this messeges:
Any suggestions guys? I don't know what to try at this point.
This is my flow I am using on my Node-Red:
[{"id":"683bce4b.da7ed","type":"modbus-read","z":"f0f61dbf.5d964","name":"Modbus TCP","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"0","quantity":"2","rate":"1","rateUnit":"s","delayOnStart":true,"startDelayTime":"1","server":"610770cd.6c00c","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"x":330,"y":700,"wires":[["6361d552.0f5f2c"],["1fed322a.4e6bce"]]},{"id":"6361d552.0f5f2c","type":"debug","z":"f0f61dbf.5d964","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":680,"wires":[]},{"id":"1fed322a.4e6bce","type":"debug","z":"f0f61dbf.5d964","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":720,"wires":[]},{"id":"610770cd.6c00c","type":"modbus-client","name":"mark220LX - TCP","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"queueLogEnabled":true,"tcpHost":"192.168.1.10","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]