Tcp in node not working sometimes


I have tcp in node where I get weight from a weighscale indicator. I notice sometime , the node suddenly stops working.(stop receiving data) but connection status is still green (OK)
node tcp in
tcp in config

In order to make it work again, I have to delete the node and then reconfigure a new TCP in node

Is there a way to refresh the node automatically? or are there nodes with better reliability. Im not sure what is causing this problem

thank you

  1. Have you tried editing the node - maybe add a name to the node - and redeploying?
  2. have you tried stop/starting NR? Does it still not work?
  3. Can you identify the exact time it stops working?
  4. Have you looked at the NR log to see if anything is showing up?
  5. what version of NR and node.js are you running (see startup log)
  6. what platform is NR running on?

In my experience, this is due to the other device not behaving correctly.

does the other device have other means of communication? Perhaps it supports an industrial protocol (Modbus?) or can be switched to UDP (UDP can be more reliable in some cases as it does not "lock up" awaiting timeouts / handshake issues)?

I have editing the port number and redeploying. This method work to reactivate the node
i did not try stop NR as there are other live application running
The time is random. Sometimes it takes a week, sometimes a month
log is empty
nodered 3.02 and node.js 16.6
Im running it on debian

Im not able to recreate this problem but my suspect is maybe network disruption(device off,network cable loose,etc) but usually nodes reconnects automatically even after a disruption

it support serial communication. There is no setting on the device to select UDP.
The device communication option is quite basic.

Is there a way to sort of redeploy the TCP in node when it stop receive data using a function node?

No & yes. You could call the node-red API endpoint to reload flows.

There is one more thing before you go down that avenue: first though - what is the device? Can you share a link to the docs? Or can you describe how your flow works? E.g, do you send something then wait for reply - or - does the device just send a continuous stream of data?

flows.json (1.8 KB)
The device is a weighscale indicator. It displays the weight and it has an ethernet and serial port. This is an industrial device found in factories. I can't find any manual but the menu is limited and just a few setting( IP address,port no., server/client(set to server))

The devices just sends a continuous stream of data.

Yes, but what is the make and model?

Have you tried client mode? It may prove more reliable.

Avery-tronix ZM305

I've tried client in the past when we were first setting up. As per my memory i believe did not work. The server setting works.

it usually most of the time works fine.But I was wondering If something could be done on the node side itself to auto refresh itself or are there other nodes that are more robust

Likely due to incorrect configuration (at node-red or device)

In theory, client would be more reliable since it becomes responsible for making connection. You likely didn't respond to commands correctly (i.e. the protocol probably expected an appropriate ACK to data transmissions) or one of many other things.

I realise you want to solve it the easy way - aka using a sledgehammer to crack a nut - but it's not the best idea (frequently reloading the flows may have other side effects like memory or resource leaks leading to crashes)

I recommend you try the client settings once more - but If you insist on the sledgehammer approach, then you need to...

  1. Reliably detect the situation then...
  2. Call the admin API endpoint POST /flows with the reload option

This will cause the runtime to reload flows from disk (and reinitialise everything, including the TCP node)

I will definitety try to test client setting and see. It is difficult to do setting changes while the plant is running as the data is recorded in our database. I will plan to test it out

I'm not in favour of redeploying the whole flow as it might reinitialise the other sub program. Is there a way just for the specific nodes to be redeployed

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.