Skip to content

Commit

Permalink
Ensure that values in PowerStatus are float
Browse files Browse the repository at this point in the history
In some cases, these values are otherwise returned as stirngs
  • Loading branch information
Johannes Griss committed Jan 13, 2024
1 parent bd30754 commit 18110fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/fusion_solar_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18110fb

Please sign in to comment.