Use timezone-aware date in SolarEdge energy details coordinator (#170969)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Franck Nijhof
2026-05-17 23:15:42 +02:00
committed by GitHub
parent 302148b078
commit f7faed7330
@@ -2,7 +2,7 @@
from abc import ABC, abstractmethod
from collections.abc import Iterable
from datetime import date, datetime, timedelta
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Any
from aiosolaredge import SolarEdge
@@ -224,9 +224,8 @@ class SolarEdgeEnergyDetailsService(SolarEdgeDataService):
async def async_update_data(self) -> None:
"""Update the data from the SolarEdge Monitoring API."""
try:
now = datetime.now()
today = date.today() # noqa: DTZ011
midnight = datetime.combine(today, datetime.min.time())
now = dt_util.now()
midnight = now.replace(hour=0, minute=0, second=0, microsecond=0)
data = await self.api.get_energy_details(
self.site_id,
midnight,