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

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.
master
Dustin 2022-08-14 20:40:25 -05:00
parent 14b6fd0046
commit 250a838b92
1 changed files with 1 additions and 1 deletions

View File

@ -170,7 +170,7 @@ impl MqttDpms {
.topics .topics
.availability .availability
.replace("@UNIQUEID@", &self.config.unique_id); .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?) Ok(client.publish(message).await?)
} }