From 3ef8c21e2d24a9065cf0673fadf59a973a2b2e4f Mon Sep 17 00:00:00 2001
From: Mark Jessop <darkside@Marks-MacBook-Pro.local>
Date: Sat, 12 Nov 2022 20:41:43 +1030
Subject: [PATCH 1/2] Add MTS01, wrap vaisala check

---
 lambda/sonde_api_to_iot_core/__init__.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py
index 2bd6a03..cedc121 100644
--- a/lambda/sonde_api_to_iot_core/__init__.py
+++ b/lambda/sonde_api_to_iot_core/__init__.py
@@ -190,7 +190,10 @@ def telemetry_filter(telemetry):
     # ~2025-2030, so have expanded the regex to match (and also support some older RS92s)
     # Modified 2021-06 to be more flexible and match older sondes, and reprogrammed sondes.
     # Still needs a letter at the start, but the numbers don't need to match the format exactly.
-    vaisala_callsign_valid = re.match(r"[C-Z][\d][\d][\d]\d{4}", _serial)
+    if ("RS41" in telemetry["type"]) or ("RS92" in telemetry["type"]):
+        vaisala_callsign_valid = re.match(r"[C-Z][\d][\d][\d]\d{4}", _serial)
+    else:
+        vaisala_callsign_valid = False
 
     # Just make sure we're not getting the 'xxxxxxxx' unknown serial from the DFM decoder.
     if "DFM" in telemetry["type"]:
@@ -220,8 +223,10 @@ def telemetry_filter(telemetry):
         or ("M20" in telemetry["type"])
         or ("LMS" in telemetry["type"])
         or ("iMet" in telemetry["type"])
+        or ("MRZ" in telemetry["type"])
+        or ("MTS01" in telemetry["type"])
     ):
-        _id_msg = "Payload ID %s is invalid." % telemetry["serial"]
+        _id_msg = "Payload ID %s from Sonde type %s is invalid." % (telemetry["serial"], telemetry["type"])
         # Add in a note about DFM sondes and their oddness...
         if "DFM" in telemetry["serial"]:
             _id_msg += " Note: DFM sondes may take a while to get an ID."

From afe35aac0332c839268ea979832591b78496bd1e Mon Sep 17 00:00:00 2001
From: Mark Jessop <darkside@Marks-MacBook-Pro.local>
Date: Sat, 12 Nov 2022 20:55:22 +1030
Subject: [PATCH 2/2] Remove MRZ entry

---
 lambda/sonde_api_to_iot_core/__init__.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py
index cedc121..2ab028d 100644
--- a/lambda/sonde_api_to_iot_core/__init__.py
+++ b/lambda/sonde_api_to_iot_core/__init__.py
@@ -223,7 +223,6 @@ def telemetry_filter(telemetry):
         or ("M20" in telemetry["type"])
         or ("LMS" in telemetry["type"])
         or ("iMet" in telemetry["type"])
-        or ("MRZ" in telemetry["type"])
         or ("MTS01" in telemetry["type"])
     ):
         _id_msg = "Payload ID %s from Sonde type %s is invalid." % (telemetry["serial"], telemetry["type"])