Initiate new connections

#1

I have tried searching but haven't found anything along the lines of my question.

Is there a node that can be used to trigger a fresh initiation of external connections?

Making a small physical move of even a comment node and then clicking deploy acheives exactly what I need, but how to automate is my question.

I use some ModbusTCP connections. If the network drops out the nodes don't reconnect.
Triggering a fresh Deploy solves the problem but requires user intervention.
I can test and also report the fault to myself as an email message, but how to automate a trigger like "Deploy"?

Same situation with an Arduino connected to Raspberry Pi by USB cable. If the connection is broken the communication doesn't restart when the connection returns. It needs to be restarted or a "Deploy"?

I look forward to thoughts or links if this has been discussed elsewhere?

Thank you.

1 Like

#2

@RickW. What you're doing when redeploying is (kinda) cause the modbus node to be killed and recreated.

Ideally, the node itself should have this capability (perhaps it supports documented/undocumented specially crafted msg to signal a disconnect/reconnect). I am of course guessing so my advice is really to raise an issue with the creator (is it on GitHub? If so, post and issue there explaining what happens and request help or a fix).

Alternatively, clone the code and add disconnect, reconnect functionality then do a pull request to the original project for the original author to incorporate your improvements.

This way, everyone benefits. The beauty of open source.

Failing that, there is probably a sledgehammer approach - run an exec command to reboot your device? Or issue a service restart command?

0 Likes

#3

Hi Steve

Thank you for reading this, giving it some thought and writing a reply.

I have used 2x different Modbus node sets (and have a similar connection issue with Arduino), so I was thinking a solution could be wider than just with the Modbus node provider.

Both of the Modbus node sets I have used have reconnection options, but they don't seem to work.
I tried mentioning it to one Modbus node provider and was asked to contribute a payment before expecting any assistance.

I am able to do a remote reboot of the Raspberry Pi, but wondered if there was a way to just restart a particular node?
Maybe use "Catch" or "Status" to trigger something, but trigger what?

Ideally I would prefer not to do a full Deploy or Reboot as this clears the history data from my dashboard trends.

0 Likes

#4

There are ways round that, there are ways of making the chart node reload the previous chart on startup.

0 Likes

#5

Thanks. I will dig deeper on that.

0 Likes

#6

In addition, it seems surprising that the nodes do not recover after a temporary disconnect. I cannot see how such a node would be satisfactory in the real world. Are you sure there is not something else going on?
How are you interrupting the connection?
It might be worth monitoring the system log while you interrupt it in case there is something useful there

tail -f /var/log/syslog

will show the log in a terminal on the fly. Post it here if you don't understand anything. You can copy from the terminal using Ctrl-Shift-C

0 Likes

#7

Not exactly in the spirit of open source - would you name and shame (post a link to where you raised the issue)?

I don't know the answer to this but would be interested. A colleague had a similar connection lost issue as yourself (with OPCUA (the IIOT nodes)) where he had to restart node-red (or re-deploy) to recover it. However, in his case, the dev fixed the issue.:slight_smile:

0 Likes

#8

Thank you for your thoughts.

I had hoped that with this occurring across 3 different input nodes, there might have been a more generic way to handle it rather than focusing back on the input node.

In the case of ModbusTCP (both different node providers), if the Ethernet connection goes down (but power stays on both the Raspberry-Pi and the ModbusTCP device) the connection never re-establishes. (even when advanced re-connection settings are activated) (but connection does re-establish if the Modbus device is rebooted without rebooting the Raspberry-Pi)
In the case of Arduino - Firmata, if the USB cable between Raspberry-Pi and Arduino Uno is unplugged (but the Raspberry-Pi stays powered up) the connection doesn't re-establish when the USB cable is plugged back in.
Both scenarios require either a contrived re-deploy, or a reboot of the Raspberry-Pi.

I will set up my test system when I get a chance to see what the logs might show.

Thank you

0 Likes

#9

If you unplug a usb cable and plug it back in then it may not connect as the same device so node red does not see it. Check in /var/log/syslog to see. The solution is to use udev rules to make it always connect as the same device. Google udev rules to find how.
For the TCP issue are you disconnecting the Ethernet cable or the adaptor? If it is the cable then are you sure it is not the other device that is locking up? If it is the node red node then raise an issue on that node.

0 Likes