fix: 记录on_disconnect日志
This commit is contained in:
parent
fb661ed02d
commit
0732b1f3e8
4
mqttc.py
4
mqttc.py
|
@ -92,8 +92,8 @@ def on_message(mqttc: mqtt.Client, userdata, msg: mqtt.MQTTMessage):
|
||||||
if topic == conf.MQTT_TOPIC:
|
if topic == conf.MQTT_TOPIC:
|
||||||
save_items(msg.payload)
|
save_items(msg.payload)
|
||||||
|
|
||||||
def on_disconnect(mqttc: mqtt.Client, userdata, rc):
|
def on_disconnect(mqttc: mqtt.Client, userdata, disconnect_flags, reason_code, properties):
|
||||||
logger.error("Disconnected from MQTT broker")
|
logger.error(f"Disconnected from MQTT broker__:{disconnect_flags}, {reason_code}")
|
||||||
|
|
||||||
|
|
||||||
def start_mqtt():
|
def start_mqtt():
|
||||||
|
|
Loading…
Reference in New Issue