Reconnecting automatically

I'm pretty new to node red and still pretty wet behind the ears with PLCs so I'm hoping that this is a simple answer but I haven't had any luck on google or the forums so I figured I'd go ahead and post to see if some experts could direct me to the answer.

I'm using node-red-contrib-pccc to connect a SCL5/05 PLC. I've got everything set up and working I thought. Over the weekend we had to do some wiring on the circuit the PLC is on and I was hoping that once the PLC was back online everything would work normally. The node-red flow was running on a computer on a separate circuit so it's power was never interrupted. Once alerted to the issue all I had to do was restart the flow and things were back to normal.

Is there any way that I can restart the flow when it reestablishes connection? Is this a case where I would need to program heartbeats into the PLC and node-red to trigger a reconnection?

Any help you can provide is greatly appreciated!

You should be able to pickup node status change with "Status" node and then if necessary restart your flows via NodeRed API

Restart flows using Node Red API (first link using forum search)

1 Like

KarolisL, Thank you very much! I'm hoping I'll be able to get that working. For some reason it didn't show up in any of my searches. I'll be able to see what the message looks like this weekend when the line shuts down but right now my "Status" node is sending an undefined message every time one of my nodes changes. I wouldn't want to restart every time so I'm hoping I'll see something when they go offline.

If I'm reading the API correctly, it will only restart the flows that are included in the payload, not all of the flows at once.

Are you looking for full msg Object in debug node? If you are getting messages then there is something out there.

Correct you can restart flows based on their name. Do you need full flows restart?

It was just the payload. I've switched it to the full object to see what I get when we shut the line off this weekend. That will be a big help in sorting out the error handling.

All I'm sure of is that we took the PLC offline, Node-RED reconnected, and I had to restart the flows to get them working how they were.

Another update after discussing things with my controls expert. It turns out that a SLC 5/05 has issues managing network traffic. Because of this our PLC was move to its own VLAN several years ago. To help the Node-RED issues he added some logic to the PLC to adjust its management and recommended that I increase the Node-RED cycle time to 3 seconds.

So far so good. I'll provide an update later. Thanks for your help!

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