Skip to content

Commit

Permalink
fix handling none values
Browse files Browse the repository at this point in the history
  • Loading branch information
hitmarten committed Jan 15, 2025
1 parent 04cb55c commit abb3b37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/remeha_home/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ async def _async_update_data(self):
]["producers"]:
for producer_stat in PRODUCER_STATS:
stat = f"{producer_stat}{producer["energyType"]}"
value = producer.get(producer_stat, 0.0)
if not isinstance(value, (int, float)):
value = 0.0

self.appliance_consumption_data[appliance_id][stat] = (
self.appliance_consumption_data[appliance_id].get(
stat, 0.0
)
+ producer.get(producer_stat, 0.0)
+ value
)

self.appliance_consumption_data[appliance_id][
Expand Down

0 comments on commit abb3b37

Please sign in to comment.