mqttdpms: Retain online availability message
Some checks failed
dustin/mqttdpms/pipeline/head There was a failure building this commit

The *online* message sent to the availability topic needs to have the
retained flag set.  Without it, when Home Assistant restarts, it will
receive the retained *offline* message and mark the entity as
unavailable.
This commit is contained in:
2022-08-14 20:40:25 -05:00
parent 14b6fd0046
commit 250a838b92

View File

@@ -170,7 +170,7 @@ impl MqttDpms {
.topics
.availability
.replace("@UNIQUEID@", &self.config.unique_id);
let message = mqtt::Message::new(topic, "online", 0);
let message = mqtt::Message::new_retained(topic, "online", 0);
Ok(client.publish(message).await?)
}