Page 1 of 1

ESP active but webpages not reachable after some time

Posted: 28 Jul 2017, 11:50
by wim16
Hello,

I am using ESP Easy since a few months now on 3 NodeMCU''s and I like it.
I only have a problem that the webpages cannot be reached after some time and the ESP is not in the IP-list of my router anymore.
All ESP's use DHCP and it looks like something is going wrong with renewing the IP-lease.
Strange enough the ESP's still report to Domoticz (on Raspberry) and they also react on commands from Domoticz.
Through the serial interface I can see that they are active as normal.

2 units is running on R120, the other on 2.0 dev 11 but all suffer from this problem.
Any ideas on what can cause this behavior?

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 11:21
by wim16
Well, it seems I am the only one with this problem.
At least I have found a workaround, using the fact that the ESP still reponds to commands from Domoticz.
I added a rule that reconnects to wifi and can be triggered from Domoticz. After that I have access to the unit again.
Since I don't need the web-gui very often this is acceptable...

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 13:16
by Domosapiens
2 units is running on R120, the other on 2.0 dev 11 but all suffer from this problem.
So it sounds like a router problem ..
but ...
and they also react on commands from Domoticz
Commands from Domoticz ... by name or IP address?
Did you make a mix of DHCP and Static IP's?

Did you try only static IP's ?

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 15:28
by wim16
Domosapiens,

yes, it may be a router problem but the ESP's are the first devices with this problem.
From Domoticz I send the commands using ESP-ip. Btw, curl or ping from the RPI also works. Using the web-browser fails.
Static IP may well solve the problem but I'd rather us the IP-reservations of my router.
I'll give one of the units a static IP and see what happens...

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 16:03
by Domosapiens
From Domoticz I send the commands using ESP-ip
Don't understand that ... DHCP can give different IP's to a node.
Do you have fixed IP's to MAC addresses within DHCP?
but I'd rather us the IP-reservations of my router
Static IP's are also reservations in the router, only outside the DHCP block.

Another suggestion:
Are you above the capability of your router?
F.i. my D-Link DIR-655 has only 25 DHCP addresses.
I use DHCP for mobile things and Static for fixed things (like Desktop and ESP's)

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 16:24
by wim16
Domosapiens wrote: 31 Jul 2017, 16:03 Do you have fixed IP's to MAC addresses within DHCP?
Yes I have, but that is not a static IP.
I static IP is managed by the device not by the router, that is why it must be outside the DHCP-block and
why I'd rather use the router functionality to reserve a certain IP for a specific MAC.

Anyway, I've set one of the ESP's to a fixed IP (so in the ESP-config) and see if that helps.

Re: ESP active but webpages not reachable after some time

Posted: 31 Jul 2017, 19:24
by Shardan
Hello all,

i use a similiar setup - i have a DNS/DHCP on an old Raspberry B and use a Ubiquiti AP for WiFi.

Due to my experience some home routers have a not really clean implementation of DHCP.
Using fixed IP's by assigning the mac to an IP adress with the router may fail if this
address is outside the DHCP range for example.

To decide if this is a ESP or router related problem a simple test should work:
If your ESPs are failing, do not touch them - reset the router instead.
If the ESPs come back then, it's more likely a router problem.
If only resetting ESP works it's more of an ESP failure i assume.

Regards
Shardan

Re: ESP active but webpages not reachable after some time

Posted: 01 Aug 2017, 06:27
by ILoveIOT
Got the same issue here, solved it for now with rebooting the esp every two hours, notice that now, the webserver stays up, the connection solution above was not working because the ESP keeps the wifi connection.

Without 2 hours reboot, cannot ping it then anymore, webserver not working, use a fixed ip everywhere, and also see that its still connected to the accesspoint, when I walk in front of the PIR (input switch), the connection will come back and can connect with the webserver. (the following not sure, can test, but even refresh or ping multiple times, will not bring him to life)

Also noticed now when i reboot them every 2 hours, want to connect to the webserver, connection failed in browser, refresh and webserver is loading, (56min running) dont use any sleep option. Not sure but it looks like the ESP going in a sleepmode on his ip stack when no clients connected, webserver and ping not working, refresh the page 1-2-3 times, and webserver and ping is coming up. When I ping the ESP the whole time, the connection stays up and webserver is responsive. Stop the ping from a client and after 5min, the webserver and ping stops responding till you refresh (f5) in browser or use ping, as you can see below it takes 5 sec to become alive.

Pingen naar 192.168.50.231 met 32 bytes aan gegevens:
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.231: bytes=32 tijd=106 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=25 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=3 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=3 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=95 ms TTL=128

Board : NodeMCU v3 (got it with 3 different boards, 2x4mb, 1x16mb)
GIT version: v2.0.0-dev11
Uptime: 0 days 1 hours 20 minutes
Load: 16% (LC=25339)
Free Mem: 22184 (16480 - sendWebPageChunkedData)

Hope it helps ;)

Re: ESP active but webpages not reachable after some time

Posted: 01 Aug 2017, 10:00
by wim16
Looks similar indeed.
I also thought of doing a reboot regularly but since the ESP keeps wifi connection my rule now contains a WifiDisconnect followed by a WifiConnect.
That works and does not destroy logs and settings.

Re: ESP active but webpages not reachable after some time

Posted: 01 Aug 2017, 10:11
by ILoveIOT
Hehe, now trying youre solution on one ESP, guess this should also work fine.

On System#Boot do
TimerSet,1,7200
endon

On Rules#Timer=1 do
WifiDisconnect
WifiConnect
TimerSet,1,7200
endon

What timer settings value do you use ?

Re: ESP active but webpages not reachable after some time

Posted: 05 Aug 2017, 12:01
by wim16
Ok, I tried using a fixed IP but the results are no different so I switched back to DHCP.

I do not use a timer to trigger my rule.
Whenever I need to access an ESP whose webgui has become unreachable I trigger the event from the RPI-commandline using

Code: Select all

curl http://ESP-ip/control?cmd=event,reconnect_wifi

Re: ESP active but webpages not reachable after some time

Posted: 05 Aug 2017, 13:16
by LisaM
I have the same problem with ArduinoEasy with fixed ethernet, encj2860 ethernet shield , no wifi. Ping works, webserver no response...

Re: ESP active but webpages not reachable after some time

Posted: 05 Aug 2017, 14:27
by Shardan
Did anyone try to restart the router instead of the ESP's?
Would be interesting if the website comes up after restarting the router.

Another interesting point:
As long as the website is reachable, watch the memory value, or send a System Info about memory to the controller.
This behaviour might be caused by a memory leak when using a specific plugin for example.

Re: ESP active but webpages not reachable after some time

Posted: 05 Aug 2017, 18:21
by wim16
I do not restart the ESP but force it to reconnect to wifi; I think restarting the router will have the same effect.
One of my ESP's is just idling without any devices, I will let it report free memory and see if that gives a clue.

Re: ESP active but webpages not reachable after some time

Posted: 08 Aug 2017, 16:17
by Shardan
wim16 wrote: 05 Aug 2017, 18:21 I do not restart the ESP but force it to reconnect to wifi; I think restarting the router will have the same effect.
It is not completely the same effect.
One of my ESP's is just idling without any devices, I will let it report free memory and see if that gives a clue.
An idling ESP without devices will show if one of the plugins you need has a memleak.... really sure?

Re: ESP active but webpages not reachable after some time

Posted: 08 Aug 2017, 18:16
by ILoveIOT
Local Time: 2017-08-08 18:09:07
Free Mem: 22592 (16168 - sendWebPageChunkedData)

Start the ping after 5min.

Pingen naar 192.168.50.231 met 32 bytes aan gegevens:
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.199: De doelhost is niet bereikbaar.
Antwoord van 192.168.50.231: bytes=32 tijd=88 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=109 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=28 ms TTL=128
Antwoord van 192.168.50.231: bytes=32 tijd=8 ms TTL=128

Local Time: 2017-08-08 18:14:36
Free Mem: 22592 (16168 - sendWebPageChunkedData)

So the mem did not change during the 5 min, hope it helps ;)

Re: ESP active but webpages not reachable after some time

Posted: 09 Aug 2017, 13:01
by wim16
Same here: free mem stays at 27960 all the time (which is about 3 days now).

Re: ESP active but webpages not reachable after some time

Posted: 18 Aug 2017, 16:42
by aero83
I was having similar issues with a basic sonoff device when connected to mains. I soldered a 470uf cap to the power pins used for programming and zero issues since.

Just a possible point to check!

Re: ESP active but webpages not reachable after some time

Posted: 18 Aug 2017, 18:36
by Shardan
aero83 wrote: 18 Aug 2017, 16:42 I was having similar issues with a basic sonoff device when connected to mains. I soldered a 470uf cap to the power pins used for programming and zero issues since.

Just a possible point to check!
Which pins exactly?
I'll check and might place a tipp in the wiki.

Regards
Shardan

Re: ESP active but webpages not reachable after some time

Posted: 19 Aug 2017, 22:26
by aero83
Shardan wrote: 18 Aug 2017, 18:36
aero83 wrote: 18 Aug 2017, 16:42 I was having similar issues with a basic sonoff device when connected to mains. I soldered a 470uf cap to the power pins used for programming and zero issues since.

Just a possible point to check!
Which pins exactly?
I'll check and might place a tipp in the wiki.

Regards
Shardan
I just soldered the cap to the VCC and GND pins on the pin header that you solder on before being able to flash the device.

Re: ESP active but webpages not reachable after some time

Posted: 21 Aug 2017, 10:46
by ILoveIOT
I tried you're solution but no luck,...soldered a 1000UF capacitor between GND and VCC on the header but the issue is still there.

Re: ESP active but webpages not reachable after some time

Posted: 27 Aug 2017, 18:28
by ILoveIOT
Looks like (not sure) the 1000UF condensator is helping a bit, but the main issue is still there, found more ppl with the same problem.

More Info https://github.com/nodemcu/nodemcu-firmware/issues/578

So i guess the issue is only on Nodemcu ? If I ping the ESP the whole day,...the issue is gone, but for me that's no solution.

Now made a blocky event for the switch, so i can use it from domoticz with 5x the same URL, so i know for sure the switch will go on, downside, has some delay, and programming is not super clean, but now I can the ESP for this project.

2017-08-27 18:29:35.688 EventSystem: Event triggered: CarportTest_1
2017-08-27 18:29:35.688 EventSystem: Fetching url...
2017-08-27 18:29:35.689 EventSystem: Fetching url...
2017-08-27 18:29:35.689 EventSystem: Fetching url...
2017-08-27 18:29:35.689 EventSystem: Fetching url...
2017-08-27 18:29:35.689 EventSystem: Fetching url...
2017-08-27 18:29:35.690 (Dummy) Lighting 1 (Carport Test)
2017-08-27 18:29:38.971 Error: Error opening url: 192.168.50.231/control?cmd=event,testrelais
2017-08-27 18:29:41.934 Error: Error opening url: 192.168.50.231/control?cmd=event,testrelais
2017-08-27 18:29:44.933 Error: Error opening url: 192.168.50.231/control?cmd=event,testrelais