diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -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!( |
