HA uses offline/online so will use that for LWT
This commit is contained in:
@@ -119,10 +119,11 @@ class HCDevice:
|
||||
)
|
||||
|
||||
if "options" in data:
|
||||
for option_uid in data["options"]:
|
||||
for option in data["options"]:
|
||||
option_uid = option["uid"]
|
||||
if str(option_uid) not in self.features:
|
||||
raise ValueError(
|
||||
f"Unable to configure appliance. Option UID {uid} is not"
|
||||
raise ValueError(
|
||||
f"Unable to configure appliance. Option UID {option_uid} is not"
|
||||
" valid for this device."
|
||||
)
|
||||
|
||||
|
||||
4
hc2mqtt
4
hc2mqtt
@@ -47,7 +47,7 @@ def hc2mqtt(
|
||||
print(now(), f"ERROR MQTT connection failed: unauthorized - {rc}")
|
||||
elif rc == 0:
|
||||
print(now(), f"MQTT connection established: {rc}")
|
||||
client.publish(f"{mqtt_prefix}LWT", payload="Online", qos=0, retain=True)
|
||||
client.publish(f"{mqtt_prefix}LWT", payload="online", qos=0, retain=True)
|
||||
# Re-subscribe to all device topics on reconnection
|
||||
for device in devices:
|
||||
mqtt_set_topic = f"{mqtt_prefix}{device['name']}/set"
|
||||
@@ -119,7 +119,7 @@ def hc2mqtt(
|
||||
else:
|
||||
client.tls_set(cert_reqs=ssl.CERT_NONE)
|
||||
|
||||
client.will_set(f"{mqtt_prefix}LWT", payload="Offline", qos=0, retain=True)
|
||||
client.will_set(f"{mqtt_prefix}LWT", payload="offline", qos=0, retain=True)
|
||||
client.on_connect = on_connect
|
||||
client.on_disconnect = on_disconnect
|
||||
client.on_message = on_message
|
||||
|
||||
Reference in New Issue
Block a user