Skip to content

Commit 276413b

Browse files
authored
fix: Statistics - compare offset-naive and offset-aware datetimes (#249)
1 parent 10f42e3 commit 276413b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

custom_components/iec/coordinator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ async def _insert_statistics(self, contract_id: int, is_smart_meter: bool) -> No
705705

706706
if readings and readings.meter_start_date:
707707
# Fetching the last reading from either the installation date or a month ago
708-
month_ago_time = max(month_ago_time, datetime.combine(readings.meter_start_date, datetime.min.time()))
708+
month_ago_time = max(month_ago_time, TIMEZONE.localize(datetime.combine(readings.meter_start_date, datetime.min.time())))
709709
else:
710710
_LOGGER.debug(
711711
"[IEC Statistics] Failed to extract field `meterStartDate`, falling back to a month ago"

0 commit comments

Comments
 (0)