From 0405d5600eaea78410bb416c5318593c259ceb10 Mon Sep 17 00:00:00 2001 From: Tediore Date: Wed, 18 Aug 2021 14:26:52 -0500 Subject: [PATCH] Add heartbeat --- battery2mqtt.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/battery2mqtt.py b/battery2mqtt.py index c7afb46..27cd217 100644 --- a/battery2mqtt.py +++ b/battery2mqtt.py @@ -132,6 +132,10 @@ def get_info(): logging.debug('Sending MQTT payload: ' + str(payload)) except Exception as e: logging.error(f'Message send failed: {e}') + try: + client.publish("battery2mqtt/" + MQTT_TOPIC + '/status', 'online', 0, True) + except Exception as e: + logging.error(f'Message send failed: {e}') check_conditions() mqtt_connect()