From 6e0c3edff68d10fdf447025cb683937b57595721 Mon Sep 17 00:00:00 2001 From: David Kendall Date: Tue, 28 Nov 2023 06:34:36 +0000 Subject: [PATCH] fix: Fixed expectation that charge_in_kwh is available in local intelligent dispatch data --- .../octopus_energy/api_client/intelligent_dispatches.py | 2 +- custom_components/octopus_energy/intelligent/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/octopus_energy/api_client/intelligent_dispatches.py b/custom_components/octopus_energy/api_client/intelligent_dispatches.py index 4bd33baa..36fd20df 100644 --- a/custom_components/octopus_energy/api_client/intelligent_dispatches.py +++ b/custom_components/octopus_energy/api_client/intelligent_dispatches.py @@ -11,7 +11,7 @@ def __init__( self, start: datetime, end: datetime, - charge_in_kwh: int, + charge_in_kwh: float, source: str, location: str ): diff --git a/custom_components/octopus_energy/intelligent/__init__.py b/custom_components/octopus_energy/intelligent/__init__.py index 6fa2680a..e460eeee 100644 --- a/custom_components/octopus_energy/intelligent/__init__.py +++ b/custom_components/octopus_energy/intelligent/__init__.py @@ -157,7 +157,7 @@ def dictionary_list_to_dispatches(dispatches: list): IntelligentDispatchItem( parse_datetime(dispatch["start"]), parse_datetime(dispatch["end"]), - int(dispatch["charge_in_kwh"]), + float(dispatch["charge_in_kwh"]) if "charge_in_kwh" in dispatch and dispatch["charge_in_kwh"] is not None else None, dispatch["source"] if "source" in dispatch else "", dispatch["location"] if "location" in dispatch else "" )