def disconnect(self):
        """ Disconnect from MQTT Broker.

        Example:
        | Disconnect |

        """
        try:
            tmp = self._mqttc
        except AttributeError:
            logger.info('No MQTT Client instance found so nothing to disconnect from.')
            return

        self._disconnected = False
        self._unexpected_disconnect = False
        self._mqttc.on_disconnect = self._on_disconnect

        self._mqttc.disconnect()

        timer_start = time.time()
        while time.time() < timer_start + self._loop_timeout:
            if self._disconnected or self._unexpected_disconnect:
                break;
            self._mqttc.loop()
        if self._unexpected_disconnect:
            raise RuntimeError("The client disconnected unexpectedly")
def disconnect ( self ) : try : tmp = self . _mqttc except AttributeError : logger . info ( 'No MQTT Client instance found so nothing to disconnect from.' ) return self . _disconnected = False self . _unexpected_disconnect = False self . _mqttc . on_disconnect = self . _on_disconnect self . _mqttc . disconnect ( ) timer_start = time . time ( ) while time . time ( ) < timer_start + self . _loop_timeout : if self . _disconnected or self . _unexpected_disconnect : break ; self . _mqttc . loop ( ) if self . _unexpected_disconnect : raise RuntimeError ( "The client disconnected unexpectedly" )
Disconnect from MQTT Broker.

        Example:
        | Disconnect |