From 4c5d384a4f18763a1edb7134aee5e1ce94fb7857 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Tue, 25 Dec 2018 20:55:30 +0100 Subject: [PATCH] check if record contains a 'date' For some reasons my Enlite Sensor/Medtronic Pump 554 is sending me a record without a 'date' field and this blocks the whole oref0-pump-loop process. --- decocare/cgm/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decocare/cgm/__init__.py b/decocare/cgm/__init__.py index 4d70afa..1b889b7 100644 --- a/decocare/cgm/__init__.py +++ b/decocare/cgm/__init__.py @@ -108,6 +108,11 @@ def decode (self): record = self.decode_record(B[0], stream, timestamp) if record['name'] == 'SensorTimestamp': + if 'date' not in record: + # should I log that I discard the record? is the record relevant without a 'date'? + # print(record) or log.warn + continue + timestamp = parser.parse(record['date']) elif self.is_relative_record(record) and timestamp: timestamp = timestamp + relativedelta(minutes=-5)