From c81c3fc896fe6f5fbd9dd48a3fb084d7fe97a337 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 21 Feb 2020 16:36:14 -0800 Subject: [PATCH] handle when requests fail... --- enphase.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/enphase.py b/enphase.py index e5a4eef..1708551 100644 --- a/enphase.py +++ b/enphase.py @@ -128,9 +128,13 @@ def thread_panels(): #reps.sort() #print '\n'.join(time.ctime(x) for x in reps) - lastrepdate = max(x['lastReportDate'] for x in r) + try: + lastrepdate = max(x['lastReportDate'] for x in r) + + waittotime = lastrepdate + 300 + 10 + except ValueError: + waittotime = 0 - waittotime = lastrepdate + 300 + 10 curtime = time.time() if waittotime < curtime: