RonnieLast
(Last of the Ronnies)
January 25, 2023, 1:19pm
6
On the basis of “[api.connection:159]: Home Assistant 2022.3.5 (192.168.0.63) requested disconnected ”, that means it’s HA doing the disconnecting. Are there any logs from HA in relation to this?
opened 07:30PM - 05 Feb 22 UTC
closed 02:52AM - 05 Jul 22 UTC
integration: api
stale
### The problem
I don't know if there is an official limit of the entities in… one ESPHome device, but it seems that after a certain number of entities the device struggles to connect to Home Assistant at all.
The same device works flawlessly if I remove devices and leaving only 20 of them. (didn't test the exact threshold)
After the device boots up, I keep getting connect/disconnect log:
```
[18:55:25][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:25][D][api:098]: Accepted 192.168.100.99
[18:55:25][D][api.connection:779]: Home Assistant 2021.12.10 (192.168.100.99): Connected successfully
[18:55:30][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:30][D][api:098]: Accepted 192.168.100.99
[18:55:30][D][api.connection:779]: Home Assistant 2021.12.10 (192.168.100.99): Connected successfully
[18:55:35][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:35][D][api:098]: Accepted 192.168.100.99
```
The defice flash is not even half full:
```
Linking /data/shc-mcn2-t2/.pioenvs/shc-mcn2-t2/firmware.elf
RAM: [= ] 13.0% (used 42472 bytes from 327680 bytes)
Flash: [===== ] 48.3% (used 886458 bytes from 1835008 bytes)
Building /data/shc-mcn2-t2/.pioenvs/shc-mcn2-t2/firmware.bin
```
### Which version of ESPHome has the issue?
Tested on: 2022.1.2 and 2022.1.3
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
Tested on: 2022.2.2 and 2021.12.10
### What platform are you using?
ESP32
### Board
ESP32 MH-ET LIVE DEVKIT
### Component causing the issue
Not sure if it is connected to platform at all or only to number of entities. Using only Switch and Binary_Sensor
### Example YAML snippet
```yaml
Submitted the whole Yaml example in the Additional info section.
```
### Anything in the logs that might be useful for us?
```txt
[18:55:25][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:25][D][api:098]: Accepted 192.168.100.99
[18:55:25][D][api.connection:779]: Home Assistant 2021.12.10 (192.168.100.99): Connected successfully
[18:55:30][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:30][D][api:098]: Accepted 192.168.100.99
[18:55:30][D][api.connection:779]: Home Assistant 2021.12.10 (192.168.100.99): Connected successfully
[18:55:35][D][api.connection:158]: Home Assistant 2021.12.10 (192.168.100.99) requested disconnected
[18:55:35][D][api:098]: Accepted 192.168.100.99
```
### Additional information
The whole example configuration yaml file:
[shc_mcn2_te2.txt](https://github.com/esphome/issues/files/8008768/shc_mcn2_te2.txt)
There is also some interesting conversation here:
You might want add a WiFi signal sensor
A weak WiFi connection is often breaking ota capabilities.
I’d suggest that you test this with the coffee machine very close to the WiFi and see if you still have issues, or try pinging the ESP for a period while the issue happens and see if you get latency jumps which might indicate WiFi issues.