From f71dbde125e72bb5980fb2d5f2ed5cc527099be2 Mon Sep 17 00:00:00 2001 From: xss Date: Tue, 13 Jun 2023 10:23:46 +1000 Subject: [PATCH] prevent future uploads --- lambda/sonde_api_to_iot_core/__init__.py | 3 +++ lambda/sonde_api_to_iot_core/__main__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py index bb5b094..27dc4ac 100644 --- a/lambda/sonde_api_to_iot_core/__init__.py +++ b/lambda/sonde_api_to_iot_core/__init__.py @@ -228,6 +228,9 @@ def telemetry_filter(telemetry): return (False, f"Unable to parse time") sonde_time_threshold = 48 + future_time_threshold_seconds = 60 + if _delta_time < -future_time_threshold_seconds: + return (False, f"Sonde reported time too far in the future. Either sonde time or system time is invalid. (Threshold: {future_time_threshold_seconds} seconds)") if abs(_delta_time) > (3600 * sonde_time_threshold): return (False, f"Sonde reported time too far from current UTC time. Either sonde time or system time is invalid. (Threshold: {sonde_time_threshold} hours)") diff --git a/lambda/sonde_api_to_iot_core/__main__.py b/lambda/sonde_api_to_iot_core/__main__.py index 4e475f7..bb576af 100644 --- a/lambda/sonde_api_to_iot_core/__main__.py +++ b/lambda/sonde_api_to_iot_core/__main__.py @@ -11,7 +11,7 @@ body = [{ "uploader_position": [53.23764, 7.74426, 7.0], "uploader_antenna": "5/8-Wave-J-Pole", "time_received": "2023-01-22T22:48:43.208780Z", - "datetime": "2023-01-22T22:48:41.000000Z", + "datetime": "2023-06-13T00:48:41.000000Z", "manufacturer": "Vaisala", "type": "RS41", "serial": "U1440085",