Ejemplo n.º 1
0
    def _on_disconnect(self, client, userdata, rc):
        self.mqtt_connected = False  # note, change this uses the property setter, do not really need to catch this in the base class

        if rc > 0:  # unexpected disconnect
            rc_text = "Unknown result code {}".format(rc)
            if rc in COONNECTION_RESULT_CODES:
                rc_text = COONNECTION_RESULT_CODES[rc]

            logger.warning("MQTT Unexpected disconnection  {} {} {}".format(
                client, userdata, rc_text))
        MQTT_Base._on_disconnect(self, rc)
Ejemplo n.º 2
0
 def _on_disconnect(self, client, packet, exc=None):
     self.mqtt_connected = False  # note, change this uses the property setter, do not really need to catch this in the base class
     logger.warning("MQTT Disconnection  {} {} {}".format(
         client, packet, exc))
     MQTT_Base._on_disconnect(self, 0)