Skip to content

Commit e24a92f

Browse files
committed
Implement @ArnoutD's idea on how many logs to collect initially
1 parent 28769c0 commit e24a92f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugwise_usb/nodes/circle.py

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

1314
from ..api import (
@@ -463,7 +464,7 @@ async def _get_initial_energy_logs(self) -> None:
463464
"Start collecting initial energy logs from the last 10 log addresses for node %s.",
464465
self._mac_in_str,
465466
)
466-
total_addresses = 11
467+
total_addresses = int(floor(datetime.now(tz=UTC).hour / 4) + 1)
467468
log_address = self._current_log_address
468469
while total_addresses > 0:
469470
result = await self.energy_log_update(log_address)

0 commit comments

Comments
 (0)