ESPHOME + NodeMcu goes offline

HI guys.
Ive got a weird problem.

I have 3 reed switches connected to a NodeMcu. For ages i had my own arduino code running on it, using MQTT and some mqtt binary_sensors in HA.

I decided to switch this over to EspHome, and got it working.

However, it keeps going unavailable. It drops off wifi, and doesnt respond to ping.

It seems to happen when a state change is triggered, but only after there has been no state change for a while. Eg the doors were all closed overnight, and when i opened one this morning, the state changed and then esphome went offline.

Is there anything obvious that I have missed ?

Config might help!

esphome:
  name: garagedoors
  platform: ESP8266
  board: nodemcu

wifi:
  ssid: "<ssid>"
  password: "<password>"
  power_save_mode: none

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: D1
    name: "Garage Front Door"
    device_class: door
    filters:
      - delayed_on: 100ms
  - platform: gpio
    pin: D2
    name: "Garage Back Door"
    device_class: door
    filters:
      - delayed_on: 100ms
  - platform: gpio
    pin: 
      number: D0
      mode: INPUT_PULLDOWN_16
    name: "Garage Roller"  
    device_class: door
    filters:
      - delayed_on: 100ms

Maybe your choice of inputs. Try using D5 instead of D0.

Also add this sensor to measure your wifi signal strength:

I will try D5. I had it on there originally and it didnt actualy work, but it may have been wiring or sometihng else untoward!

its less than 2m from a unifi pro AP, with no walls or anything else obstructing the signal. But it cant hurt to add it in!

yes, I am noticing this on one of my esp8266 nodemcu I am using D1 for the pir sensor. There are a few others around the home that use the same D1 pin and not drop when it trigger, but it does lose wifi every so often. That is another issue yet to be solve from the community. I will try D5, though I had tried D4 in the pass and it would not connect.

binary_sensor:
  - platform: status
    name: $name dht Status

  - platform: gpio
    pin: D1
    name: 'motion sr occupancy'
    device_class: motion

I have 4 NodeMCU connected to 25+ reed switches throughout the house and noticed that on ESPHome the board(s) goes offline (just like you noted). But I also found that when I click on “Logs” for the offline boards the logs are populated immediately and the reed switches seem to work (status changes in the UI) even when ESPHome is showing the board as offline.

Since the functionality does not seem affected and the reed switches works fine so I’m less concerned about the status on ESPHome page.

Hope this helps.

This item in the FAQ may or may not apply to your case, but the things it suggests trying may be helpful in any case.

But I also found that when I click on “Logs” for the offline boards the logs are populated immediately and the reed switches seem to work (status changes in the UI) even when ESPHome is showing the board as offline.

That is most fortune for you. My case isn’t the same, when it goes offline, the pir and the dht22 connected to it does not register at all until it goes back online and this could be anywhere between few seconds to 1 minutes.

I have changed the pin to D5. I will monitor it for a few days. I did saw it went offline once, but it wasn’t because the pir was triggered.

I have added most in the FAQ, but didn’t try reboot_timeout: 0s. Will add now. This node is the closes to the router (next room) than others that doesn’t seem to have this problem.