From 18110fb786584feb6189899a71bb698afb24c856 Mon Sep 17 00:00:00 2001 From: Johannes Griss Date: Sat, 13 Jan 2024 09:44:40 +0100 Subject: [PATCH] Ensure that values in PowerStatus are float In some cases, these values are otherwise returned as stirngs --- setup.cfg | 2 +- src/fusion_solar_py/client.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 04e065e..33b2f68 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = fusion_solar_py -version = 0.0.19 +version = 0.0.20 author = Johannes Griss author_email = johannes.griss@meduniwien.ac.at description = A simply API to the Huawei Fusion Solar web interface. diff --git a/src/fusion_solar_py/client.py b/src/fusion_solar_py/client.py index a0f762a..6020f19 100644 --- a/src/fusion_solar_py/client.py +++ b/src/fusion_solar_py/client.py @@ -408,9 +408,9 @@ def get_power_status(self) -> PowerStatus: power_obj = r.json() power_status = PowerStatus( - current_power_kw=power_obj["data"]["currentPower"], - energy_today_kwh=power_obj["data"]["dailyEnergy"], - energy_kwh=power_obj["data"]["cumulativeEnergy"], + current_power_kw=float( power_obj["data"]["currentPower"] ), + energy_today_kwh=float( power_obj["data"]["dailyEnergy"] ), + energy_kwh=float( power_obj["data"]["cumulativeEnergy"] ), ) return power_status