[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -179,7 +179,7 @@ def client_connect(client, device, mqtt_topic):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
msg = dev[device["name"]].recv()
|
msg = dev[device["name"]].recv()
|
||||||
client.publish(F"{mqtt_topic}/LWT", "online")
|
client.publish(f"{mqtt_topic}/LWT", "online")
|
||||||
if msg is None:
|
if msg is None:
|
||||||
break
|
break
|
||||||
if len(msg) > 0:
|
if len(msg) > 0:
|
||||||
@@ -211,7 +211,7 @@ def client_connect(client, device, mqtt_topic):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(now(), device["name"], "ERROR", e, file=sys.stderr)
|
print(now(), device["name"], "ERROR", e, file=sys.stderr)
|
||||||
client.publish(F"{mqtt_topic}/LWT", "offline", retain=True)
|
client.publish(f"{mqtt_topic}/LWT", "offline", retain=True)
|
||||||
|
|
||||||
time.sleep(40)
|
time.sleep(40)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user