Improved the mechanism for extracting the presence device name
This commit is contained in:
parent
47afda8dee
commit
9fd3890c45
|
@ -44,8 +44,8 @@ impl OnMqtt for Presence {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO More robust mechanism for splitting
|
let offset = self.mqtt.topic.find('+').or(self.mqtt.topic.find('#')).unwrap();
|
||||||
let device_name = message.topic.rsplit_once("/").unwrap().1;
|
let device_name = &message.topic[offset..];
|
||||||
|
|
||||||
if message.payload.len() == 0 {
|
if message.payload.len() == 0 {
|
||||||
// Remove the device from the map
|
// Remove the device from the map
|
||||||
|
|
Loading…
Reference in New Issue
Block a user