This commit is contained in:
2025-08-26 12:40:37 +02:00
parent 9cf123382e
commit 1714817673

View File

@@ -199,11 +199,12 @@ hm = socket.gethostbyaddr(BACKUP_HOST)
logging.info(_RESTORE) logging.info(_RESTORE)
def send_mqtt_message(topic,msg): def send_mqtt_message(topic,msg):
global client client2 = mqtt.Client()
client2.username_pw_set(USERNAME, PASSWORD)
try: try:
#client.connect(broker,1883,60) client2.connect(broker,1883,60)
client.publish(topic, json.dumps(msg)) client2.publish(topic, json.dumps(msg))
#client.disconnect() client2.disconnect()
logging.info(f"Message sent {topic}, {msg}") logging.info(f"Message sent {topic}, {msg}")
except ValueError as e: except ValueError as e:
logging.error("Failed to send") logging.error("Failed to send")