Skip to content

Commit

Permalink
fix: Issue with coordinator on 1st on the month (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyKh authored Apr 1, 2024
1 parent 0794cc2 commit 3a98b7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/iec/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,13 @@ async def _async_update_data(
remote_reading = await self._get_readings(contract_id, device.device_number, device.device_code,
yesterday,
ReadingResolution.WEEKLY)
if remote_reading[device.device_number]:
if remote_reading:
daily_readings[device.device_number] += remote_reading.data
weekly_future_consumption = remote_reading.future_consumption_info

# Remove duplicates
daily_readings[device.device_number] = list(dict.fromkeys(daily_readings))
daily_readings[device.device_number] = (
list(dict.fromkeys(daily_readings[device.device_number])))

# Sort by Date
daily_readings[device.device_number].sort(key=lambda x: x.date)
Expand Down

0 comments on commit 3a98b7a

Please sign in to comment.