| @@ -28,7 +28,7 @@ def file_thread(file): | |||||
| def process_IN_CLOSE_WRITE(self, event): | def process_IN_CLOSE_WRITE(self, event): | ||||
| global reload, config | global reload, config | ||||
| with lock_reload: | with lock_reload: | ||||
| print("Triggering reload") | |||||
| print("Triggering file reload") | |||||
| config = None | config = None | ||||
| reload = True | reload = True | ||||
| cond_reload.notify_all() | cond_reload.notify_all() | ||||
| @@ -54,9 +54,13 @@ def mqtt_thread(): | |||||
| def on_message(client, userdata, message): | def on_message(client, userdata, message): | ||||
| global reload, config | global reload, config | ||||
| with lock_reload: | 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) | subscribe.callback(on_message, mqtt.topic, hostname=mqtt.hostname, auth=mqtt.auth, port=8883, tls=mqtt.tls) | ||||