Skip to content

Commit 688014f

Browse files
committed
CRAI: improve total_addresses calculation
1 parent e9943e6 commit 688014f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from datetime import UTC, datetime
99
from functools import wraps
1010
import logging
11-
from math import floor
1211
from typing import Any, Final, TypeVar, cast
1312

1413
from ..api import (
@@ -462,7 +461,7 @@ async def _get_initial_energy_logs(self) -> None:
462461
"Start collecting today's energy logs for node %s.",
463462
self._mac_in_str,
464463
)
465-
total_addresses = int(floor(datetime.now(tz=UTC).hour / 4) + 1)
464+
total_addresses = min(MAX_LOG_HOURS / 2, datetime.now(tz=UTC).hour + 1)
466465
log_address = self._current_log_address
467466
while total_addresses > 0:
468467
result = await self.energy_log_update(log_address)

0 commit comments

Comments
 (0)