def connection_lost(self, exc):
        """Handle lost connection."""
        _LOGGER.debug('Connection lost with %s', self.transport.serial)
        if exc:
            _LOGGER.error(exc)
            self.transport.serial.close()
            self.conn_lost_callback()
        self.transport = None
Handle lost connection.