mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-23 16:57:47 +01:00
Fix disconnect message not being sent when disconnecting during hello phase (#396)
This commit is contained in:
parent
f2e1942666
commit
81f6e67038
@ -645,8 +645,11 @@ class APIConnection:
|
||||
await self.send_message_await_response(PingRequest(), PingResponse)
|
||||
|
||||
async def disconnect(self) -> None:
|
||||
if self._connection_state != ConnectionState.CONNECTED:
|
||||
# already disconnected
|
||||
if not self._is_socket_open or not self._frame_helper:
|
||||
# We still want to send a disconnect request even
|
||||
# if the hello phase isn't finished to ensure we
|
||||
# the esp will clean up the connection as soon
|
||||
# as possible.
|
||||
return
|
||||
|
||||
self._expected_disconnect = True
|
||||
|
Loading…
Reference in New Issue
Block a user