From ec04624776e0ebe56d64638969902ef3eed5fc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=BCrl?= Date: Thu, 28 Nov 2024 11:18:49 +0100 Subject: [PATCH] type mapping for basic and unknown types --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/data/openmqttgateway/mod.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6c7974..9455765 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1533,7 +1533,7 @@ dependencies = [ [[package]] name = "mqtt-gateway" -version = "0.4.1" +version = "0.4.2" dependencies = [ "anyhow", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 4f017a2..3064763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mqtt-gateway" -version = "0.4.1" +version = "0.4.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/data/openmqttgateway/mod.rs b/src/data/openmqttgateway/mod.rs index 0beb38b..50cdb71 100644 --- a/src/data/openmqttgateway/mod.rs +++ b/src/data/openmqttgateway/mod.rs @@ -104,8 +104,11 @@ impl OpenMqttGatewayParser { } if fields.contains_key("rssi") && fields.len() > 1 && tags.len() > base_tag_count { - data = Some(Data { fields, tags }); + tags.insert(String::from("type"),String::from("NONE")); + } else if !tags.contains_key("type") { + tags.insert(String::from("type"),String::from("UNKN")); } + data = Some(Data { fields, tags }); } } Ok(data)