Esp8266 goes to unavailable on every update

I have an esp-12f board connected to two temp sensors, one am2302 and one si7021 setup as below

esphome:
  name: attic
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: !secret attic_ssid
  password: !secret attic_pw
  output_power: 10

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  # ap:
  #   ssid: "Attic Fallback Hotspot"
  #   password: "jiA3wt2plnUP"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

sensor:
  - platform: dht
    pin: D7
    model: si7021
    temperature:
      name: "Attic Temperature"
      filters:
      - offset: 0
    humidity:
      name: "Attic Humidity"
    update_interval: 60s
    
  - platform: dht
    pin: D2
    model: AM2302
    temperature:
      name: "Comms Cabinet Temperature"
    humidity:
      name: "Comms Cabinet Humidity"
    update_interval: 60s    

The problem I am having is that on (almost) every update I see the values going to unavailable ofr a second or two and the values flash on my dashboards which is quite annoying.

image

According to logs it might be rebooting each time?

WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to attic.local:6053 (192.168.0.200)
INFO Successfully connected to attic.local
[17:01:19][D][dht:048]: Got Temperature=37.9°C Humidity=31.7%
[17:01:19][D][sensor:117]: 'Comms Cabinet Temperature': Sending state 37.90000 °C with 1 decimals of accuracy
[17:01:19][D][sensor:117]: 'Comms Cabinet Humidity': Sending state 31.70000 % with 0 decimals of accuracy
[17:01:22][D][dht:048]: Got Temperature=28.9°C Humidity=57.3%
[17:01:22][D][sensor:117]: 'Attic Temperature': Sending state 28.90000 °C with 1 decimals of accuracy
[17:01:22][D][sensor:117]: 'Attic Humidity': Sending state 57.30000 % with 0 decimals of accuracy
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to attic.local:6053 (192.168.0.200)
INFO Successfully connected to attic.local
[17:02:19][D][dht:048]: Got Temperature=37.9°C Humidity=31.5%
[17:02:19][D][sensor:117]: 'Comms Cabinet Temperature': Sending state 37.90000 °C with 1 decimals of accuracy
[17:02:19][D][sensor:117]: 'Comms Cabinet Humidity': Sending state 31.50000 % with 0 decimals of accuracy
[17:02:22][D][dht:048]: Got Temperature=28.9°C Humidity=57.2%
[17:02:22][D][sensor:117]: 'Attic Temperature': Sending state 28.90000 °C with 1 decimals of accuracy
[17:02:22][D][sensor:117]: 'Attic Humidity': Sending state 57.20000 % with 0 decimals of accuracy
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to attic.local:6053 (192.168.0.200)
INFO Successfully connected to attic.local

Anyone know how I might fix this?
I also tried a wemos d1 mini and the same happens with that
Signal is great as it is about 1m from router: Signal strength: -49 dB
Can the two temp sensors draw too much power and cause it to reboot?

I am a complete novice with ESPHome, but I had a similar problem that after upgrading, my nodes went into RED status on the ESPHome page. The only way to revert to a prior version was to manually flash them with an older .bin file. Pain in the ass if the device is behind a wall switch.

What I discovered was that if I comment out ap: and captive_portal: then flash the device, it then connects with a green bar and I could upload a new configuration with the latest upgrade.

#  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Outside Temperature"
#    password: "SPaWmSyjy2r6"
#
#captive_portal:

I don’t know if it’s a memory limitation, but it works for me.

So they are green for me, I can update the node via wifi no problem and the AP I have also turned it off
Just seems like they reboot on every 60 sec and then immediately connect back

Frequent rebooting can mean that you have two devices with the same node name. Duplicate IP addresses can do the same, which is why I never use fixed IP’s.

I think some of the sensors shared a node, I went in and did a clean build files, deleted anything related to the old node and redeployed once more.
I don’t have static ip set either.
All made no difference :frowning:
Even if I can get it to no longer to go unavailable for the split second that would do it, don’t care it resets anyway as long as it keeps old value before updating

How is the attic node powered?
What is the rssi at the attic node?

sensor:
  # WiFi Signal sensor.
  - platform: wifi_signal
    name: Attic WiFi Signal
    update_interval: 60s

Powered from a NAS USB port, signal is quite strong: 'Attic WiFi Signal': Sending state -40.00000 dBm
Tried running it with just one temp sensor, made no difference either

I’m just scratching y head now. I’ve never used either of those sensors- I either use a DHT or DS18B20 sensor.

Can you plug in a 1 Amp (or better) USB power supply? There’s no reason that the NAS port could be a problem, but try a separate power source to eliminate it as a possibility.

Also, have you tried removing one of the sensors?

Yup I tried with one sensor only and made no difference.
Will need to dig for one of those 1a micro usb power adapters and try it out.
Ok maybe it is pointing out that, the router is in a network rack, which is metal :grimacing:


But I have an inverter which uses the same wifi (big white thing on the right) and that doesn’t complain.

Shouldn’t be an issue with an rssi of -40. My D1’s work reliably down to -90.

When I am using the Wemos D1 Mini on the Arduino IDE, I can see the reboot reason (a number from 0 to 7) on the Serial monitor. I don’t know if the ESPhome has a way to see this.

Something else to try:
fast_connect: true

“fast_connect (Optional, boolean): If enabled, directly connects to WiFi network without doing a full scan first. This is required for hidden networks and can significantly improve connection times. Defaults to off. The downside is that this option connects to the first network the ESP sees, even if that network is very far away and better ones are available.”

fast_connect also doesn’t help.
Need to try a power supply next but won’t be until tomorrow until I can get up there again

If your attic is anything like mine, you can only go up an hour after sundown until an hour after sunup.

Just curious, try a shorter update interval.

This would be the first thing I’d replace. Or try another USB lead at least.

I had a node do exactly the same thing. It had bad capacitors on the board and whenever it transmitted data it would reboot. The power drawn by transmitting was just too much. Soldering on some new capacitors fixed it in my case, but in your’s it may just be either the voltage drop in the USB lead or the port not being able to supply enough current.

It might just be broken. (The esp device I mean)

The fact that both a d1 mini and a nodemcu board do this leads me to believe it’s something else

Power supply / cabling is the only common factor (given that the wifi rssi is excellent).

Thinking that too, trying to find a separate power supply to test with

1 Like

Or a battery. 3X 1.5V cells is close enough to 5V to power a Wemos D1 Mini or a NodeMCU

I would check power supply, too. When i test my modules in my workshop, connected to lab power supply current consumption is indeed in the range under 100mA, but spikes when transmitting over wifi can cause current limit, set to 0.5A to react momentarily, which means that very short current spike can exceeds 0.5A. Least you can do is connect a large electrolytic capacitor in parallel (on +5V and GND), say 1000uF, even 2200uF…

And since these are cheap d1 mini clones it might not even get to 500ma but only 300ma.
I ordered a few original boards directly from Lollin but will take a while for delivery from China.