diff --git a/blinky.py b/blinky.py index d473737..14f1519 100755 --- a/blinky.py +++ b/blinky.py @@ -28,7 +28,7 @@ def file_thread(file): def process_IN_CLOSE_WRITE(self, event): global reload, config with lock_reload: - print("Triggering reload") + print("Triggering file reload") config = None reload = True cond_reload.notify_all() @@ -54,9 +54,13 @@ def mqtt_thread(): def on_message(client, userdata, message): global reload, config with lock_reload: - config = json.loads(message.payload) - reload = True - cond_reload.notify_all() + print("Triggering MQTT reload") + try: + config = json.loads(message.payload) + reload = True + cond_reload.notify_all() + except: + print("Invalid MQTT config") subscribe.callback(on_message, mqtt.topic, hostname=mqtt.hostname, auth=mqtt.auth, port=8883, tls=mqtt.tls)