ESPHome devices lose their connection

I have the same issue with some esp32: are you using BLE_Tracker component?
I saw the randomic behaviour you mentioned with it.

Also, quite interestingly, I have been in touch with Synology (makers of my router) support: they are stating ESP32, although losing connection to HA, are NOT losing connection to wifi network…which if true would be definelty point the problem to ESPHome.

I have no proof of that unluckily

I just restarted HA again and now I’m back to stability! Go figure.

I’m not running BLE tracker.

I’m not losing connection to the network either. It’s just the ESPHome-HA API pipe that breaks.

It was fine for about 30 minutes and then the issue returned.

I’ve flashed another ESP32 with the same binary and, for now, it seems to be stable.

this happens to me too: flashing, ESP32 is fine, after few weeks starts to lose connection.

Removing power for 30-40s and connecting it back makes no difference: reflashing does

Are you saying reflashing the same device or flashing another device with the same binary?

same device, but after a while it re-start to have troubles.

I am not saying reflashing makes the trick, just saying there is something strange between HA and ESP32 connection status.
It also happens with ESP8266 to be honest

I just reflashed my original ESP32 and it still has the problem. Putting back the alternate, same binary, problem gone.

do you have same power supply in your tests between the two ESP?

I had this issue (ESP32 only) and found that it was due to GPIO I was using that were also used by the WiFi chip… changed GPIO and no more issues.

ADC2 (and WiFi in ESP32) uses GPIOs 0, 2, 4, 12 13 14 15 and 25 26 27

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/adc.html

The table on this page lists the best ESP32 GPIO to use:

And for the ESP8266

3 Likes

Hi everyone,

I had the same problem with ESPHome as wel on Tasmota with all my Shellies… But not anymore :smile:

In your acces point (this fixed my tasmota, but not yet the ESPHomes):

  • Set your wifi to 20mhz only, so no auto 20/40mhz
  • Set an fixed channel, again not auto…

In Esphome:

esphome:
  name: "${ippostfix}_${devicename}"
  platform: ESP8266
  board: esp8285
  arduino_version: 2.4.2

# WIFI settings
wifi:
  fast_connect: true
  reboot_timeout: !secret wifi_reboot_timeout  #= 45min
  power_save_mode: none
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password

ESPHome add-on: is only running when i want to do changes (read it in this thread, don’t know if it helps or not)

The ESPHome yaml part is probably not all necassary, but hey it works…

I’m interested if any one here which had this kind of connection losses with 1.14.x does expierence this ones too on the most recent beta 1.15.0b3. It has quite some fundamental changes bumping for example the arduino core to a very recent version (which introduced a new bug to quash actually :pensive:)

Would be nice if you could test and report back. If you still have troubles best would be to directly catch some logs and open a new issue mentioning you are using 1.15.

I have no troubles so far with the 1.15 beta (can be easily installed in parallel to stable and dev with the hassio addon :tada:)

1 Like

Hi, I solved my problem by buying a new router, I connected all ESPhome devices to a separate SSID. For 2 days I have never lost the connection. Previously, there were 20-200 connection losses per day.

How is HA connecting to the EspHome nodes if they are in two separate subnets?

Router is connected as AP and it is in the same subnet.

Guest AP I use for ESPhome only.

You can do this - you need an AVAHI reflector on both subnets so that the mDNS requests can be seen

Craig

1 Like

I had a major issue with esp8266 and esp32 devices dropping significant number of packets. My laptop as well but not nearly as bad. If I took the esp devices to a different part of my house, the problem stopped. Took me quite a bit of troubleshooting but I after loading a wifi analyzer on my phone, I noticed this device broadcasting low power then higher power and higher and higher every 30 seconds or so. When it got closer to the higher power the esp devices started dropping off the network and my laptop showed low WiFi signal.

I narrowed the signal down to my bedroom. The only wireless device in there is my Roku 3. I started doing some research and found that certain roku devices will broadcast higher and higher signals while attempting to contact the AP. Then it dawned on me…even though that Roku was hard wired now, it was connected to an old SSID that I retired a month or so prior. It was trying to find that old SSID for some reason and was drowning out the ESP devices as well as my laptop. I connected it to the new SSID then back to Ethernet and the problem was instantly resolved.

Yesterday I set up a brand new Gosund SP-1 plug with the latest ESPHome 1.14.x (using the API, not MQTT), and I also experienced disconnections to both Home Assistant and the ESPHome log viewer constantly, with each connection lasting no more than 3 minutes in general.

I tried several things, including changing the WiFi SSID (I have 2 access points, but this happened with both), WiFi power mode, etc.

Today I saw @orange-assistant’s answer, and tried flashing ESPHome 1.15.0b3 to see if that would work. As of now, I haven’t had any disconnection and the plug works wonderfully!


Image: The disconnections can be seen throughout the status bar. After flashing the beta release, you can see the switch status stays in the ‘on’ position without being disconnected.

So, at least for me, it seems like some recent change has fixed these issues.

I’ll post another update here after some time has passed, so I can tell you how everything went, and whether the problem came back.

1 Like

Sorry, but it looks like I jumped to conclusions, the problem remains, but it appears much less often.

I’m on the some boat… a lot of disconnets in the api when using ping to the device everything is ok