OK - I don’t think it is my imagination.
The device (‘Seeed Xiao ES032S3 Sense’ with a camera) is connected to my iMac via a powered USB hub. The HA runs on a Raspberry Pi 4 in another room. The device connects over WiFi
I unplugged the cable from the hub, waited a few moments and then plugged it in again. I waited over 10 minutes (breakfast!) and there was still nothing - the ESPHome display showed it as ‘Offline’ and the main display showed the card as ‘Unavailable’.
I connected to the serial port (using the ‘screen’ command on the iMac) and I immediately got the log below. My interpretation is that the device had tried several times to reboot in attempts to connect and when I started the serial connection, it proceeded as normal.
On the HA screens, the device was seen as ‘OnLine’ and an image was quickly displayed.
Just as an experiment, I commented out the ‘logger:’ line in the yaml file and the code was recompiled and uploaded to the device. When it rebooted, it became visible to HA within (perhaps) 10 seconds.
To confirm this, I uncommented the ‘logger:’ line and recompiled the code. On uploading (via OTA) the problem reappeared.
My conclusion is that the Logger is somehow blocking until it can send via a serial connection which is preventing a normal startup.
Susan
The log file (edited to remove local details only) is:
ESP-ROM:esp32s3-20210327
[I][logger:262]: Log initialized
[C][ota:469]: There have been 4 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences [C][wifi:038]: Setting up WiFi...
[C][wifi:048]: Starting WiFi...
[C][wifi:049]: Local MAC: 48:27:E2:E7:65:68
[D][wifi:425]: Starting scan...
[D][wifi:440]: Found networks:
[I][wifi:484]: - 'xxxx' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:485]: Channel: 6
[D][wifi:486]: RSSI: -71 dB
[D][wifi:489]: - 'xxxxxxxx' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - '' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[I][wifi:274]: WiFi Connecting to 'xxxx'...
[W][wifi:609]: WiFi Unknown connection status 0
[I][wifi:274]: WiFi Connecting to 'xxxx'...
[W][wifi_esp32:504]: Event: Disconnected ssid='xxxx' bssid=xx:xx:xx:xx:xx:xx reason='Association Leave'
[W][wifi:609]: WiFi Unknown connection status 0
[D][esp32_camera:196]: Got Image: len=11252
[D][wifi:425]: Starting scan...
[D][wifi:440]: Found networks:
[D][wifi:440]: Found networks:
[I][wifi:484]: - 'xxxx' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:485]: Channel: 6
[D][wifi:486]: RSSI: -71 dB
[D][wifi:489]: - 'xxxxxxxx' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - '' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[D][wifi:489]: - 'xxxxxxxx'' (xx:xx:xx:xx:xx:xx) ▂▄▆█
[I][wifi:274]: WiFi Connecting to 'xxxx'...
[W][wifi:609]: WiFi Unknown connection status 0
[I][wifi:274]: WiFi Connecting to 'xxxx'...
[W][wifi_esp32:504]: Event: Disconnected ssid='xxxx' bssid=xx:xx:xx:xx:xx:xx reason='Association Leave'
[W][wifi:609]: WiFi Unknown connection status 0
[I][wifi:557]: WiFi Connected!
[C][wifi:379]: Local MAC: xx:xx:xx:xx:xx:xx
[C][wifi:380]: SSID: 'xxxx'
[C][wifi:381]: IP Address: 10.1.1.119
[C][wifi:383]: BSSID: xx:xx:xx:xx:xx:xx
[C][wifi:384]: Hostname: 'patio'
[C][wifi:386]: Signal strength: -72 dB ▂▄▆█
[C][wifi:390]: Channel: 6
[C][wifi:391]: Subnet: 255.255.255.0
[C][wifi:392]: Gateway: 10.1.1.1
[C][wifi:393]: DNS1: 10.1.1.1
[C][wifi:394]: DNS2: 0.0.0.0
[D][wifi:566]: Disabling AP...
[C][ota:093]: Over-The-Air Updates:
[C][ota:094]: Address: patio.local:3232
[C][ota:097]: Using Password.
[W][ota:103]: Last Boot was an unhandled reset, will proceed to safe mode in 6 restarts
[C][api:025]: Setting up Home Assistant API server...
[I][app:062]: setup() finished successfully!
[I][app:102]: ESPHome version 2023.6.5 compiled on Jul 19 2023, 08:15:08
[C][wifi:543]: WiFi:
[C][wifi:379]: Local MAC: xx:xx:xx:xx:xx:xx
[C][wifi:380]: SSID: 'xxxx'
[C][wifi:381]: IP Address: 10.1.1.119
[C][wifi:383]: BSSID: xx:xx:xx:xx:xx:xx
[C][wifi:384]: Hostname: 'patio'
[C][wifi:386]: Signal strength: -72 dB ▂▄▆█
[C][wifi:390]: Channel: 6
[C][wifi:391]: Subnet: 255.255.255.0
[C][wifi:392]: Gateway: 10.1.1.1
[C][wifi:393]: DNS1: 10.1.1.1
[C][wifi:394]: DNS2: 0.0.0.0
[C][logger:301]: Logger:
[C][logger:302]: Level: DEBUG
[C][logger:303]: Log Baud Rate: 115200
[C][logger:305]: Hardware UART: UART0
[C][esp32_camera:048]: ESP32 Camera:
[C][esp32_camera:049]: Name: Patio
[C][esp32_camera:050]: Internal: NO
[C][esp32_camera:052]: Data Pins: D0:15 D1:17 D2:18 D3:16 D4:14 D5:12 D6:11 D7:48
[C][esp32_camera:053]: VSYNC Pin: 38
[C][esp32_camera:054]: HREF Pin: 47
[C][esp32_camera:055]: Pixel Clock Pin: 13
[C][esp32_camera:056]: External Clock: Pin:10 Frequency:20000000
[C][esp32_camera:060]: I2C Pins: SDA:40 SCL:39
[C][esp32_camera:062]: Reset Pin: -1
[C][esp32_camera:080]: Resolution: 640x480 (VGA)
[C][esp32_camera:129]: JPEG Quality: 10
[C][esp32_camera:131]: Contrast: 0
[C][esp32_camera:132]: Brightness: 0
[C][esp32_camera:133]: Saturation: 0
[C][esp32_camera:134]: Vertical Flip: ON
[C][esp32_camera:135]: Horizontal Mirror: ON
[C][esp32_camera:136]: Special Effect: 0
[C][esp32_camera:137]: White Balance Mode: 0
[C][esp32_camera:140]: Auto Exposure Control: 1
[C][esp32_camera:141]: Auto Exposure Control 2: 0
[C][esp32_camera:142]: Auto Exposure Level: 0
[C][esp32_camera:143]: Auto Exposure Value: 300
[C][esp32_camera:144]: AGC: 1
[C][esp32_camera:145]: AGC Gain: 0
[C][esp32_camera:146]: Gain Ceiling: 0
[C][esp32_camera:152]: Test Pattern: NO
[C][psram:020]: PSRAM:
[C][psram:021]: Available: YES
[C][psram:024]: Size: 8191 KB
[C][captive_portal:088]: Captive Portal:
[C][mdns:112]: mDNS:
[C][mdns:113]: Hostname: patio
[C][ota:093]: Over-The-Air Updates:
[C][ota:094]: Address: patio.local:3232
[C][ota:097]: Using Password.
[W][ota:103]: Last Boot was an unhandled reset, will proceed to safe mode in 6 restarts
[C][api:138]: API Server:
[C][api:139]: Address: patio.local:6053
[C][api:141]: Using noise encryption: YES
[D][api:102]: Accepted 10.1.1.2
[D][api.connection:1030]: Home Assistant 2023.7.2 (10.1.1.2): Connected successfully
[D][esp32_camera:196]: Got Image: len=15629
[D][api:102]: Accepted 10.1.1.2
[D][api.connection:1030]: ESPHome Logs 2023.6.5 (10.1.1.2): Connected successfully
[I][app:102]: ESPHome version 2023.6.5 compiled on Jul 19 2023, 08:15:08
[C][wifi:543]: WiFi: