Good afternoon community. I've flashed a Sonos S31 with ESPhome, gone into HA and seen the integration discovered, but after I add it, the device is not visible or controllable or found.
My YAML on the S31 is here:
https://gist.github.com/shevett/ff93327611238c353a056ac70ab05c3b
The device pings strongly, no dropped packets, and wifi strength is excellent
The device however does drop from HA, and I don't know why - i suspect this is the core of the problem - I can't get a long lived connection so pairing it to HA is failing?
Here's the log from esphome web:
8:41:56.422][C][wifi_signal.sensor:017]: WiFi Signal 'Sonoff S31 WiFi Signal' [18:41:56.422][C][wifi_signal.sensor:017]: State Class: 'measurement' [18:41:56.422][C][wifi_signal.sensor:017]: Unit of Measurement: 'dBm' [18:41:56.422][C][wifi_signal.sensor:017]: Accuracy Decimals: 0 [18:41:56.423][C][wifi_signal.sensor:163]: Device Class: 'signal_strength' [18:41:56.423][C][mdns:177]: mDNS: [18:41:56.423][C][mdns:177]: Hostname: esphome-web-282b68 [18:41:57.487][D][sensor:118]: 'Sonoff S31 Voltage' >> 116.15 V [18:41:58.715][D][sensor:118]: 'Sonoff S31 Energy' >> 0.01 Wh [18:41:58.715][D][sensor:118]: 'Sonoff S31 Power' >> 0.00 W [18:41:58.715][D][sensor:118]: 'Sonoff S31 Daily Energy' >> 0.00 Wh [18:41:59.739][D][sensor:118]: 'Sonoff S31 Apparent Power' >> 0.0 VA [18:41:59.739][D][sensor:118]: 'Sonoff S31 Power Factor' >> 1.00 [18:42:00.617][D][sensor:118]: 'Sonoff S31 WiFi Signal' >> -43 dBm [18:42:01.265][D][sensor:118]: 'Sonoff S31 Current' >> 0.00 A [18:42:26.139][W][api.connection:2236]: Home Assistant 2025.3.4 (192.168.68.63): Reading failed CONNECTION_CLOSED errno=11
On HA, here's what the logs are saying
`Logger: aioesphomeapi.connection
Source: runner.py:154
First occurred: February 20, 2026 at 9:40:41 PM (625 occurrences)
Last logged: 1:18:48 PM
esphome-web-282b68 @ 192.168.68.181: Connection error occurred: esphome-web-282b68 @ 192.168.68.181: Connection lost
esphome-web-282b68 @ 192.168.68.181: Connection error occurred: [Errno 104] Connection reset by peer`
Note the disconnect at the end happens 20 seconds after the initial load. This is consistent. There are no other (that I can tlel) devices on the network stealing the IP (I did an arp check and the mac address never changes, and my DNS server has this on a fixed IP).
ESPhome shows the device online, and I can pull the YAML from it and see it's complete.
If I try to add the device manually, I get a "Device is already configured" (the API key handshake is successful)
My HA server is in a docker container in 'host' networking mode. My ESPHome web instance is also in a docker container, in 'host' networking mode.
I've force-reloaded he integration, removed the device and allowed it to be rediscovered - still no dice.
I've run out of things to try. Any asisstance would be useful.