ESP2866 sometimes disconnects from API after toggling

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?

There is also some interesting conversation here:

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.