Improved how mqtt topics are handled

This commit is contained in:
2023-01-06 05:25:39 +01:00
parent 1326a8878c
commit 47afda8dee
8 changed files with 58 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
use std::time::Duration;
use pollster::FutureExt;
use rumqttc::AsyncClient;
use rumqttc::{AsyncClient, matches};
use tokio::task::JoinHandle;
use tracing::{error, debug, warn};
@@ -50,7 +50,7 @@ impl OnPresence for ContactSensor {
impl OnMqtt for ContactSensor {
fn on_mqtt(&mut self, message: &rumqttc::Publish) {
if message.topic != self.mqtt.topic {
if !matches(&message.topic, &self.mqtt.topic) {
return;
}