From 0af1968892d716c720c54d63b602883a9aafbbb1 Mon Sep 17 00:00:00 2001 From: Daniel Raper Date: Mon, 8 Jul 2024 20:37:32 +0100 Subject: [PATCH] Add additional None check --- custom_components/ohme/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ohme/utils.py b/custom_components/ohme/utils.py index 193c2bd..baf4bd8 100644 --- a/custom_components/ohme/utils.py +++ b/custom_components/ohme/utils.py @@ -35,7 +35,7 @@ def slot_list(data): slots = [] wh_tally = 0 - if 'batterySocBefore' in data and data['batterySocBefore'] is not None: + if 'batterySocBefore' in data and data['batterySocBefore'] is not None and data['batterySocBefore']['wh'] is not None: wh_tally = data['batterySocBefore']['wh'] # Get the wh value we start from for slot in session_slots: