Skip to content

Commit 5d44536

Browse files
committed
Improve vars as suggested, correction
1 parent b518b82 commit 5d44536

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugwise/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def __init__(
338338
SmileData.__init__(self)
339339

340340
self.smile_hostname: str | None = None
341-
self._previous: str = "0"
341+
self._previous_day_number: str = "0"
342342
self._target_smile: str | None = None
343343

344344
async def connect(self) -> bool:
@@ -528,12 +528,11 @@ async def _full_update_device(self) -> None:
528528
async def async_update(self) -> PlugwiseData:
529529
"""Perform an incremental update for updating the various device states."""
530530
# Perform a full update at day-change
531-
new = dt.datetime.now().strftime("%w")
532-
if new != self._previous: # pylint: disable=consider-using-assignment-expr
531+
day_number = dt.datetime.now().strftime("%w")
532+
if day_number != self._previous_day_number: # pylint: disable=consider-using-assignment-expr
533533
LOGGER.debug(
534534
"Performing daily full-update, reload the Plugwise integration when a single entity becomes unavailable."
535535
)
536-
self._previous = new
537536
self.gw_data: GatewayData = {}
538537
self.gw_devices: dict[str, DeviceData] = {}
539538
await self._full_update_device()
@@ -555,6 +554,7 @@ async def async_update(self) -> PlugwiseData:
555554
self._update_gw_devices()
556555
self.gw_data["notifications"] = self._notifications
557556

557+
self._previous_day_number = day_number
558558
return PlugwiseData(self.gw_data, self.gw_devices)
559559

560560
async def _set_schedule_state_legacy(

0 commit comments

Comments
 (0)