Fix ordering

This commit is contained in:
Richard Mitchell
2019-04-18 14:24:21 +01:00
parent 07c2ba696f
commit 653ceba6d3

View File

@@ -466,8 +466,8 @@ class TuyaDevice:
sock.connect((self.host, self.port))
except socket.timeout as e:
raise ConnectionTimeoutException("Connection timed out") from e
self._connected = True
self.reader, self.writer = await asyncio.open_connection(sock=sock)
self._connected = True
asyncio.ensure_future(self._async_handle_message())
asyncio.ensure_future(self._async_ping())