# Esp8266 needs reset after router reboot

**URL:** <https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619>\
**Category:** Hardware\
**Created:** [16 August 2023 22:20 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619 "2023-08-16T22:20:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![richiep](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@richiep](https://discourse.nodered.org/u/richiep)\
**Post date:** [16 August 2023 22:20 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/1 "2023-08-16T22:20:21Z")

</div>

Hey all,  
I had to restart my router, a rare occurrence, and I lost communication with my esp8266 boards. After the reboot I had to reset all of my esp8266 boards. I'm communicating with them through Mosquito and MQTT.

Is there a way to reconnect without having to reset?

Thanks  
R

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [16 August 2023 22:49 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/2 "2023-08-16T22:49:11Z")

</div>

If they are not connected to wifi you don't have many options.

Powering off and back on is probably easiest, you shouldn't lose anything.

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [17 August 2023 00:39 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/3 "2023-08-17T00:39:29Z")

</div>

This is a node red forum so you may get better/more advice in a ESP forum. You talk about MQTT so I presume you are using some type of WIFI but you don't say what libraries you use either. There should be a couple of commands  
WiFi.setAutoReconnect(true);  
WiFi.persistent(true);  
or some form there of you should be using.

---

<div class="post-metadata">

**Author:** ![MDAR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mdar/32/10700_2.png) [@MDAR](https://discourse.nodered.org/u/MDAR)\
**Post date:** [17 August 2023 06:30 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/4 "2023-08-17T06:30:07Z")

</div>

There is a `ESP.restart` command, you could possibly add a loop with a heartbeat count from incoming MQTT messages and issue a restart?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 August 2023 07:08 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/5 "2023-08-17T07:08:20Z")

</div>

If you disable wifi in the router for 60 seconds and then enable it again do you see the same problem?

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [17 August 2023 08:14 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/6 "2023-08-17T08:14:15Z")

</div>

I use ESPHome in all my "home brewed ESP device setups", they all reconnect automatically via wifi when and if needed. The same goes for all my Shelly devices. Maybe consider other sw packages for your devices?

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [17 August 2023 09:08 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/7 "2023-08-17T09:08:06Z")

</div>

Looks like the software in you ESP8266 is not testing for wifi and mqtt connection on regular base.  
It's way out of scope of this forum to help you with that. Have a look [here](https://randomnerdtutorials.com/solved-reconnect-esp8266-nodemcu-to-wifi/) to see how to solve this issue.

---

<div class="post-metadata">

**Author:** ![MDAR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mdar/32/10700_2.png) [@MDAR](https://discourse.nodered.org/u/MDAR)\
**Post date:** [17 August 2023 20:17 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/8 "2023-08-17T20:17:51Z")

</div>

> [@edje11](#):
>
> It's way out of scope of this forum to help you with that. Have a look [here](https://randomnerdtutorials.com/solved-reconnect-esp8266-nodemcu-to-wifi/) to see how to solve this issue.

I didn't realise I was looking for something like this.

I hope it helps the OP too.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 October 2023 20:18 UTC](https://discourse.nodered.org/t/esp8266-needs-reset-after-router-reboot/80619/9 "2023-10-16T20:18:41Z")

</div>

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