From c99f6e6c32914a947c426d3e17e225e8c8564195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 8 Sep 2019 20:12:13 +0100 Subject: freestyle devices: don't error out if there are no readings. The multi-record format returns "Log Empty" if there's no entry in the device, catch that. --- glucometerutils/support/freestyle.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py index 3c337f6..5b441ff 100644 --- a/glucometerutils/support/freestyle.py +++ b/glucometerutils/support/freestyle.py @@ -275,6 +275,10 @@ class FreeStyleHidDevice(hiddevice.HidDevice): in the record file. """ message = self._send_text_command(command) + logging.debug('Received multirecord message:\n%s', message) + if message == "Log Empty\r\n": + return () + match = _MULTIRECORDS_FORMAT.search(message) if not match: raise exceptions.InvalidResponse(message) -- cgit v1.2.3