diff --git a/Messaging/clientEx copy.py b/Messaging/clientEx copy.py index 301c5e8..b9d21ee 100644 --- a/Messaging/clientEx copy.py +++ b/Messaging/clientEx copy.py @@ -5,9 +5,8 @@ import ssl import json cfg = None -with open('../config.json') as json_config: +with open('config.json') as json_config: cfg = json.load(json_config) - connected = False def on_connect(client, userdata, flags, rc): @@ -35,11 +34,11 @@ mqttc.on_connect = on_connect mqttc.on_disconnect = on_disconnect mqttc.on_message = on_message -mqttc.connect(cfg.mqtt.host, cfg.mqtt.port, cfg.mqtt.timeout) +mqttc.connect(cfg["mqtt"]["host"], cfg["mqtt"]["port"], cfg["mqtt"]["timeout"]) mqttc.loop_start() -mqttc.will_set("hello/test", "Disconnected", ) +# mqttc.will_set("hello/test", "Disconnected", ) pub = input("Enter something to publish: ")