Retain per device online LWT messages

This commit is contained in:
Meatballs1
2024-05-05 14:42:35 +01:00
parent d5a8f4ad03
commit 6933a1f97d

View File

@@ -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)