Skip to content

Commit

Permalink
fix: avg sensor measurements never being set (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
woopstar authored Feb 23, 2025
1 parent 890aadc commit 3d40f28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/hsem/custom_sensors/avg_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ async def _async_store_utility_meter_value(self) -> None:
except Exception:
utility_meter_value = None

if utility_meter_value is not None and self._measurements is not None:
if self._measurements is None:
self._measurements = {}

if utility_meter_value is not None:
self._measurements[current_date.isoformat()] = round(
float(utility_meter_value), 2
)
Expand Down

0 comments on commit 3d40f28

Please sign in to comment.