N-RED server (raspberry ZW) still off after reconnect to wifi

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.

I appreciate any help.

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?

I cant access from my PC using rasp IP:1880 and the server no longer responds to commands that i send from my pc ou smartphone.

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?

When its working i can get normal reply from ping, but after internet goes down i will no to test, cant say it for sure.

and about the ip, sorry i dont undestant that much, i think its the internal network, its my raspberry ip from my router.

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?

i will need to test*, sorry.

i save the ifconfig when its running normal. When it goes down again i will check to see the result.

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?

That can get nasty.

Say the internet IS down. You don't want the RasPi rebooting every 5 minutes.

I too have a RasPi zero (W). It is painful when the WAP goes down.
WAP - how that machine talks to the internet.

Reading your posts some things come to mind needing answering.

So what I believe:

All working fine.

Internet goes down.

Internet comes back up.

The RasPi is non responsive.

You still haven't said if it is the RasPi or Node-Red
If you can ping the RasPi from another machine that is good.

But I am seeing you say:

To me that means Node-red isn't running.

Which is a whole other thing.

First thing to do:
ssh to the RasPi.
sudo systemctl status nodered.service

What does that say?

It will be either running or stopped (I think.)
(Isn't too hard to get the take on what it is doing.)

Argh!

So it isn't headless. (Yeah, my bad.)
Then it (the RasPi) may not be connected to your WAP.

As said a few times by @Colin: On the RasPi:
ifconfig and see if wlan0 is doing.

My Zero has a real bad time when my WAP goes down.
And WAP is very different to internet.

Though when the internet goes down the WAP seems to go down in sympathy. (Annoying)

Honestly, you could save a lot of pain and get a RasPi 3b and connect it via ethernet.
That will get rid of a lot of the problems you are having.

Unless you want the portability the Zero offers. Though a 3B is not much bigger. So really that isn't a reason.

All that stuff about ssh.... Well, if you have a monitor: open a terminal (CLI) and type the command.

It has already been established that node-red is running.

As I said, the first thing to determine is where the connection is failing, so we need the answer to the questions I asked in my previous post.

@danielbgc It would also be useful to see the results of the ifconfig command before and after the failure.

Fair enough.

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.

Best to start a new thread then But first look in the log on the pi to see what happened. For example has the wifi disconnected?

I'm not too worried I was just mentioning that I have a similar problem and offering suggestions.

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