From 5577cf678563e064c84faefeb010f4684060eda7 Mon Sep 17 00:00:00 2001 From: freol35241 Date: Fri, 11 Aug 2023 13:43:54 +0200 Subject: [PATCH] Explicitly converting any timestamps as strings to floats to ensure correct input type to .fromtimestamp --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e738c03..6ec024d 100644 --- a/main.py +++ b/main.py @@ -135,7 +135,7 @@ def extract_values_from_message(message: MQTTMessage) -> Tuple[Any]: fields["parameter_id"] = f"{fields.pop('tag')}_{fields.pop('index')}" # Convert timestamp into datetime format - fields["timestamp"] = datetime.fromtimestamp(fields["timestamp"]) + fields["timestamp"] = datetime.fromtimestamp(float(fields["timestamp"])) LOGGER.debug("After conversions: %s", fields)