Skip to content

Commit

Permalink
Fix #196
Browse files Browse the repository at this point in the history
  • Loading branch information
DarwinsBuddy committed Nov 11, 2023
1 parent 21f3fe7 commit 54e330e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/wnsm/statistics_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ async def _import_historical_data(self, smartmeter: Smartmeter):
for ts, usage in sorted(dates.items(), key=itemgetter(0)):
total_usage += usage
statistics.append(StatisticData(start=ts, sum=total_usage, state=usage))

_LOGGER.debug(f"Importing statistics from {statistics[0]} to {statistics[-1]}")
if len(statistics) > 0:
_LOGGER.debug(f"Importing statistics from {statistics[0]} to {statistics[-1]}")
async_import_statistics(self.hass, metadata, statistics)

async def _import_statistics(self, smartmeter: Smartmeter, start: datetime, total_usage: Decimal):
Expand Down

0 comments on commit 54e330e

Please sign in to comment.