Modbus Read Node Error

I am Using Modbus Read node for getting TCP Port Data.

My Tcp ip:

if i use " sudo nc -l 502" i got list of json data.but when I use edge work flow I got only
modbus read error:TCP Connection Time Out.

please find the screen shots for Edge Work flow:

Container Name:docs-agent8

Docker Command:
sudo docker run -d --restart always --name docs-agent8
-v /var/lib/losant-edge-agent/data:/data
-v /var/lib/losant-edge-agent/config.toml:/etc/losant/losant-edge-agent-config.toml

1.Data for Port 502

2.Edge Work flow
readnodeconfig readnode1 readnode2


“results”: {
“modbusdata”: {
“errors”: [
** “message”: “TCP Connection Timed Out.”**
}strong text

My requirement:
if I send some data to specific tcp port like and port number 502,
I can view the data using sudo nc -l 502 command.but i cannot get the data using losant Edge workflow.please give me the steps what i have to do.

Sivasankari S

Hello Sivasankari,

Thank you for the post. I have listed two suggestions below that you can try to resolve this error.

  1. In the Modbus: Read Node, you currently have the Timeout Template set to 60. This field is in milliseconds. The default value when this field is empty is 30 seconds. You can try clearing this value so the default is 30 seconds and then once you get it working you can lower this number to the appropriate value.
  2. Your screenshot from your terminal output shows a uid of 1. In your workflow, the Modbus: Read Node has a Unit ID Template configured for 0. Try changing this Unit ID Template from a 0 to a 1. Here is more information on Unit ID when using Modbus TCP with the Modbus: Read Node.

Thank you Sivasankari,

Thank you very much kevin,
I have changed unit id as 1 and timeout template is 30 but I got the same error.

I want to try the simple solution for this.

if i send some data to tcpip and port( and 502) using terminal like

sudo nc 502
{ “data”:{ “msg1”:“sankari”}}

i can get the above data using the command “sudo nc -l 502”

I want to get the same data using losant,for this which node I have to use?
please give me the do you have any specific node for this?

Thank you,
Sivasankari S


Now that you have the Timeout Template field cleared (so that it will default to 30000 milliseconds), try changing the Modbus: Read Node Address Template that you are reading from 0 to 7 and the Modbus: Read Node Length Template from 1000 to 1. In the first screenshot you sent, it looks like non-zero data exists on register 7 and it also looks like there are only 13 registers. Once we can read one register, then we can try reading multiple registers at one time.

If this does not initially work, try changing the Unit ID Template again (from either a 1 to a 0 or a 0 to a 1).

In regards to using the command “sudo nc -l 502”, you can use the Run Executable Node in the Edge Workflow. If you go this route, you might have to allow Docker to share the host’s network stack. If you have additional questions with this route, I would recommend creating a new post so that this thread can remain about Modbus.

Thank you Sivasankari,

1 Like

Thank you very muck Kevin.

I want to listen data what I have sent to to the specific port.I will create a new post for further queries.

Thank you ,
Sivasankari S