Fix retained otp messages bug

This commit is contained in:
Linus Dietz
2024-05-29 20:08:19 +02:00
parent a7a2e1182c
commit f650ea9247
4 changed files with 13 additions and 5 deletions
+6 -3
View File
@@ -131,9 +131,12 @@ def on_disconnect(client, userdata, rc):
def on_message(client, userdata, msg):
payload = msg.payload.decode("UTF-8")
if msg.topic == otp_mqtt_topic:
global otp_code
otp_code = payload
set_otp_state()
if msg.retain == 0:
global otp_code
otp_code = payload
set_otp_state()
else:
logging.warning("Found retained OTP, this can't work! Pleas clean retained messages!")
return None
else:
try: