code: def connection_lost(self, exc):
          
          _LOGGER.error("Disconnected: %s", exc)
          self.connected = False
          self.transport.close()
          if self._report_task is not None:
              self._report_task.cancel()
          self._msg_task.cancel()
          for q in [self._cmdq, self._updateq, self._msgq]:
              while not q.empty():
                  q.get_nowait()
          self.status = {}
docs: Gets called when the connection to the gateway is lost.
          Tear down and clean up the protocol object.