aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embedded-mqtt/src/lib.rs3
-rw-r--r--src/lib.rs10
2 files changed, 11 insertions, 2 deletions
diff --git a/embedded-mqtt/src/lib.rs b/embedded-mqtt/src/lib.rs
index 096af63..7367b53 100644
--- a/embedded-mqtt/src/lib.rs
+++ b/embedded-mqtt/src/lib.rs
@@ -71,6 +71,7 @@ where
71pub struct ConnectParams<'a> { 71pub struct ConnectParams<'a> {
72 pub will_topic: Option<&'a str>, 72 pub will_topic: Option<&'a str>,
73 pub will_payload: Option<&'a [u8]>, 73 pub will_payload: Option<&'a [u8]>,
74 pub will_retain: bool,
74 pub username: Option<&'a str>, 75 pub username: Option<&'a str>,
75 pub password: Option<&'a [u8]>, 76 pub password: Option<&'a [u8]>,
76 pub keepalive: Option<u16>, 77 pub keepalive: Option<u16>,
@@ -197,7 +198,7 @@ where
197 password: params.password, 198 password: params.password,
198 will_topic: params.will_topic, 199 will_topic: params.will_topic,
199 will_payload: params.will_payload, 200 will_payload: params.will_payload,
200 will_retain: false, 201 will_retain: params.will_retain,
201 keepalive: None, 202 keepalive: None,
202 }, 203 },
203 ); 204 );
diff --git a/src/lib.rs b/src/lib.rs
index 3353663..ca2ab82 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -541,6 +541,7 @@ impl<'a> Device<'a> {
541 let connect_params = embedded_mqtt::ConnectParams { 541 let connect_params = embedded_mqtt::ConnectParams {
542 will_topic: Some(availability_topic), 542 will_topic: Some(availability_topic),
543 will_payload: Some(NOT_AVAILABLE_PAYLOAD.as_bytes()), 543 will_payload: Some(NOT_AVAILABLE_PAYLOAD.as_bytes()),
544 will_retain: true,
544 ..Default::default() 545 ..Default::default()
545 }; 546 };
546 if let Err(err) = client 547 if let Err(err) = client
@@ -665,7 +666,14 @@ impl<'a> Device<'a> {
665 } 666 }
666 667
667 if let Err(err) = client 668 if let Err(err) = client
668 .publish(availability_topic, AVAILABLE_PAYLOAD.as_bytes()) 669 .publish_with(
670 availability_topic,
671 AVAILABLE_PAYLOAD.as_bytes(),
672 embedded_mqtt::PublishParams {
673 retain: true,
674 ..Default::default()
675 },
676 )
669 .await 677 .await
670 { 678 {
671 crate::log::error!( 679 crate::log::error!(