Merge pull request #66 from Meatballs1/online_lwt
Retain per device online LWT messages
This commit is contained in:
@@ -182,8 +182,7 @@ def client_connect(client, device, mqtt_topic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def on_open(ws):
|
def on_open(ws):
|
||||||
client.publish(f"{mqtt_topic}/LWT", "", retain=True)
|
client.publish(f"{mqtt_topic}/LWT", "online", retain=True)
|
||||||
client.publish(f"{mqtt_topic}/LWT", "online")
|
|
||||||
|
|
||||||
def on_close(ws, code, message):
|
def on_close(ws, code, message):
|
||||||
client.publish(f"{mqtt_topic}/LWT", "offline", retain=True)
|
client.publish(f"{mqtt_topic}/LWT", "offline", retain=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user