From c1dff533ae08c5b4c8ca267b33309bb7cb8801c9 Mon Sep 17 00:00:00 2001 From: hultenvp <61835400+hultenvp@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:06:04 +0200 Subject: [PATCH] Ignore energy today drops if offline --- custom_components/solis/service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/custom_components/solis/service.py b/custom_components/solis/service.py index 095e141..f061823 100644 --- a/custom_components/solis/service.py +++ b/custom_components/solis/service.py @@ -36,7 +36,7 @@ _LOGGER = logging.getLogger(__name__) # VERSION -VERSION = '1.0.1' +VERSION = '1.0.2' # Don't login every time HRS_BETWEEN_LOGIN = timedelta(hours=2) @@ -161,8 +161,11 @@ async def update_devices(self, data: GinlongData) -> None: # messes up the energy dashboard. Return 0 while inverter is # still off. is_am = datetime.now().hour < 12 - if getattr(data, INVERTER_STATE) == 2 and is_am: - value = 0 + if getattr(data, INVERTER_STATE) == 2: + if is_am: + value = 0 + else: + return elif getattr(data, INVERTER_STATE) == 1 and is_am: last_updated_state = None try: