mirror of
https://github.com/esphome/esphome.git
synced 2024-11-07 09:31:10 +01:00
Fix api client disconnect handler
This commit is contained in:
parent
894ec07cc8
commit
71ba4bc31c
@ -321,7 +321,7 @@ class APIClient(threading.Thread):
|
|||||||
self._close_socket()
|
self._close_socket()
|
||||||
|
|
||||||
if self.on_disconnect is not None and on_disconnect:
|
if self.on_disconnect is not None and on_disconnect:
|
||||||
self.on_disconnect()
|
self.on_disconnect(None)
|
||||||
|
|
||||||
def _check_authenticated(self):
|
def _check_authenticated(self):
|
||||||
if not self._authenticated:
|
if not self._authenticated:
|
||||||
@ -410,7 +410,7 @@ class APIClient(threading.Thread):
|
|||||||
self._socket = None
|
self._socket = None
|
||||||
self._connected = False
|
self._connected = False
|
||||||
if self.on_disconnect is not None:
|
if self.on_disconnect is not None:
|
||||||
self.on_disconnect()
|
self.on_disconnect(None)
|
||||||
elif isinstance(msg, pb.PingRequest):
|
elif isinstance(msg, pb.PingRequest):
|
||||||
self._send_message(pb.PingResponse())
|
self._send_message(pb.PingResponse())
|
||||||
elif isinstance(msg, pb.GetTimeRequest):
|
elif isinstance(msg, pb.GetTimeRequest):
|
||||||
|
Loading…
Reference in New Issue
Block a user