From c6fb43c4ef47a8bd878b9bcf2fd879d9646c7e64 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 6 Sep 2022 17:47:09 +0200 Subject: [PATCH] RPI: don't throw exception when no valid frame was received --- tools/rpi/hoymiles/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpi/hoymiles/__init__.py b/tools/rpi/hoymiles/__init__.py index ed1bcdd3..d6ca70d2 100644 --- a/tools/rpi/hoymiles/__init__.py +++ b/tools/rpi/hoymiles/__init__.py @@ -647,7 +647,7 @@ class InverterTransaction: self.time_rx = end_frame.time_rx tr_len = end_frame.seq - 0x80 except StopIteration: - seq_last = max(frames, key=lambda frame:frame.seq).seq + seq_last = max(frames, key=lambda frame:frame.seq).seq if len(frames) else 0 self.__retransmit_frame(seq_last + 1) raise BufferError(f'Missing packet: Last packet {len(self.scratch)}')