From 6933a1f97d88670129eacbaff03822c013c0fe52 Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Sun, 5 May 2024 14:42:35 +0100 Subject: [PATCH] Retain per device online LWT messages --- hc2mqtt.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hc2mqtt.py b/hc2mqtt.py index 0ecc325..083a592 100755 --- a/hc2mqtt.py +++ b/hc2mqtt.py @@ -182,8 +182,7 @@ def client_connect(client, device, mqtt_topic): ) def on_open(ws): - client.publish(f"{mqtt_topic}/LWT", "", retain=True) - client.publish(f"{mqtt_topic}/LWT", "online") + client.publish(f"{mqtt_topic}/LWT", "online", retain=True) def on_close(ws, code, message): client.publish(f"{mqtt_topic}/LWT", "offline", retain=True)