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?
@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?
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.
There are ways round that, there are ways of making the chart node reload the previous chart on startup.
Thanks. I will dig deeper on that.
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
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.
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.
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.
I'm browsing this forum because I have sometimes the same kind of problem: my node-red flows disconnects themselves from a modbus PLC (and the plc is running OK and still visible in my network).
When I notice the problem, I have to restart node-red and everything is then ok for XX hours.
Did you find a solution (self-reboot node-red or self-restart flows) for your problem that I could apply to mine ?
Possibly a bug with that node.
I'd recommend that you locate the node in GitHub and add an issue and your screenshot to help the author assess/fix it.
Thank you, I received a YT vid to see about modbus/node-red/mqtt, will watch it and will contact the author.