From 32a18e165eb67a74b95e85ec0bdb388a2fb613e0 Mon Sep 17 00:00:00 2001 From: Jeff Culverhouse Date: Fri, 21 Feb 2025 22:09:35 -0500 Subject: [PATCH] clean code --- amcrest2mqtt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amcrest2mqtt.py b/amcrest2mqtt.py index 5d493d8..a33764c 100644 --- a/amcrest2mqtt.py +++ b/amcrest2mqtt.py @@ -116,7 +116,11 @@ def mqtt_connect(): mqtt_client.username_pw_set(mqtt_username, password=mqtt_password) try: - mqtt_client.connect(mqtt_host, port=mqtt_port) + mqtt_client.connect( + mqtt_host, + port=mqtt_port, + keepalive=60 + ) mqtt_client.loop_start() except ConnectionError as error: log(f"Could not connect to MQTT server: {error}", level="ERROR")