From 3fb12a58a802374ab8fb285aff52b9b4d4abf98e Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 08:40:32 +0200 Subject: [PATCH] k --- examples/mqtt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index 0c044bd..bde8a5d 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -13,6 +13,7 @@ import time from PIL import Image,ImageDraw,ImageFont import traceback from paho.mqtt import client as mqtt_client +import paho.mqtt.client as paho logging.basicConfig(level=logging.DEBUG) @@ -37,15 +38,15 @@ broker = "192.168.99.224" port = 8883 topic = "openWB/evu/W" username = "mqtt-user" -password = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP" +pw = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP" client_id = "solarmonitor" -client = mqtt_client.Client(client_id) -client.username_pw_set(username, password) +client = mqtt_client.Client(client_id, protocol=paho.MQTTv31) +client.username_pw_set(username, password=pw) client.on_connect = on_connect client.on_message = on_message -client.connect(broker, port) +client.connect(broker, port=port) client.loop_start() #start the loop