summaryrefslogtreecommitdiff
path: root/src/relay_mqtt_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/relay_mqtt_util.py')
-rwxr-xr-xsrc/relay_mqtt_util.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/relay_mqtt_util.py b/src/relay_mqtt_util.py
index 29a0532..45d2405 100755
--- a/src/relay_mqtt_util.py
+++ b/src/relay_mqtt_util.py
@@ -39,4 +39,7 @@ if __name__ == '__main__':
mqtt_relay = MQTTRelay(devices=MQTTRelayDevice(id=arg.device_id))
mqtt_relay.set_message_callback(on_mqtt_message)
mqtt_relay.configure_tls()
- mqtt_relay.connect_and_loop()
+ try:
+ mqtt_relay.connect_and_loop()
+ except KeyboardInterrupt:
+ mqtt_relay.disconnect()