In summary, I run a node-red server on a raspberry pi (zero w in desktop OS), almost everything works perfectly.
My only problem is the internet at my house, sometimes it goes down and reconnects. After that happens and the rasp manages to reconnect to the internet, but the server apparently remains offline.
I can even access the page of the nodes through the raspberry (using the monitor, since I use Desktop OS), but it no longer responds to commands that I send from outside and I can no longer access the page of the nodes by the IP address.
So, every time this happens I need to restart my raspberry to get it back to normal.
I thought about restart raspberry if lost connection to the internet, but I don't know how I could do that.
When you you say it is not accessible via its ip address is that the ip address on the local network or is it only access via the router's external ip address that does not work?
By rasp IP do you mean the ip on the internal network? If you ping that address does it reply?
What does ifconfig
show on the pi before and after the problem?
Sorry, I don't understand what that means. We need an answer to that question as it will tell us whether the pi is responding at all to the network.
Also run the command ifconfig
in a terminal on the pi. Copy and paste the output somewhere. When it fails run that command again and then post both here.
What is the ip address you are using to access it?
Sorry for the confusion. I found out more about it. In fact, what was offline was not the node red server, but the internet connection of the raspberry pi itself.
How can I make the raspberry test the internet every 5 minutes for example, in case it is offline, it does a reboot?
I would first try and understand what is failing, it should automatically reconnect. Do you mean that the pi cannot access the internet (can you browse to google.com on the pi?) Or do you mean you cannot access the pi from the internet?
And again I have a very similar - if not the same problem - with a RasPi Z (W) but mine is headless.
Sometimes it goes offline as far as my system is concerned, but when it is rebooted, (powered down and back up) it was running NR and working up until that time.