From cc3a21b0d1ffbaa4331e941742e541aa484f72b1 Mon Sep 17 00:00:00 2001 From: Linkis112 Date: Thu, 11 Sep 2025 13:54:49 +0200 Subject: [PATCH] initial commit of mqtt client --- mqtt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mqtt.py b/mqtt.py index 357605b..75c00e5 100644 --- a/mqtt.py +++ b/mqtt.py @@ -7,9 +7,10 @@ def on_connect(client, userdata, flags, reason_code, properties): print(f"Connected with result code {reason_code}") # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. - client.subscribe("$SYS/#") - client.subscribe('test/hallo') + #client.subscribe("$SYS/#") + client.subscribe('test/topic') client.subscribe('homeassistant/status') + publish.single('test/topic', 'Hello, MQTT!', hostname='192.168.188.30', auth={'username': 'mqtt', 'password': 'mqtt'}) # The callback for when a PUBLISH message is received from the server.