From fc23cb7f6565ce09ac2ecbc51d0f22731b77bf94 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Mon, 5 Aug 2024 13:06:49 -0700
Subject: [PATCH] Plugin_046: Xiron: don't reject the measurement if humidity
 is > 100%

My sensor may return humidity over 100% when the sensor is saturated,
clamp the data instead of rejecting the measurement altogether.

Also mention that "Xiron" protocol is known as "Nexus-TH" in other
sources
---
 RFLink/Plugins/Plugin_046.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/RFLink/Plugins/Plugin_046.c b/RFLink/Plugins/Plugin_046.c
index f31a59b9..c159bf88 100644
--- a/RFLink/Plugins/Plugin_046.c
+++ b/RFLink/Plugins/Plugin_046.c
@@ -28,7 +28,7 @@
  * E = Always 1111 ?
  * F = Always 0000 0000 ?
  *
- * Xiron Message Format: 
+ * Xiron Message Format (also known as Nexus-TH in other sources): 
  * 01101110 10 00 000011101101 1111 00110011
  * AAAAAAAA BB CC DDDDDDDDDDDD EEEE FFFFFFFF
  * ID       ?? Ch Temperature  ?    Humidity
@@ -178,8 +178,10 @@ boolean Plugin_046(byte function, const char *string)
    }
    if (type == 1)
    {
-      if (humidity > 100)
-         return false; // humidity out of range ( > 100)
+      // Certain sensors return humidity higher than 100% when the sensor is saturated.
+      // Clamp it to 99% instead of rejecting the measurement
+      if (humidity >= 100)
+         humidity = 99;
    }
    //==================================================================================
    // Output