mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-08-13 11:19:52 +02:00
Fix retained otp messages bug
This commit is contained in:
+6
-3
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user