Skip to content

Commit 9a5cb09

Browse files
committed
Implement CRAI suggestions
1 parent 3ec80dd commit 9a5cb09

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
DEFAULT_FIRMWARE: Final = datetime(2008, 8, 26, 15, 46, tzinfo=UTC)
7676

7777
MAX_LOG_HOURS = DAY_IN_HOURS
78-
MAX_ADDRESSES_COLLECTED: Final = 11
7978

8079
FuncT = TypeVar("FuncT", bound=Callable[..., Any])
8180
_LOGGER = logging.getLogger(__name__)
@@ -455,7 +454,7 @@ async def energy_update(self) -> EnergyStatistics | None: # noqa: PLR0911 PLR09
455454
return None
456455

457456
async def _get_initial_energy_logs(self) -> None:
458-
"""Collect initial energy logs for the hours elapsed today up to MAX_LOG_HOURS ."""
457+
"""Collect initial energy logs for the hours elapsed today up to MAX_LOG_HOURS."""
459458
if self._current_log_address is None:
460459
return
461460

@@ -469,8 +468,8 @@ async def _get_initial_energy_logs(self) -> None:
469468

470469
# When only consumption is measured, 1 address contains data from 4 hours
471470
# When both consumption and production are measured, 1 address contains data from 2 hours
472-
factor = 4 if self.energy_production_interval is not None else 2
473-
max_addresses_to_collect = int(MAX_LOG_HOURS / factor)
471+
factor = 4 if self.energy_production_interval is None else 2
472+
max_addresses_to_collect = MAX_LOG_HOURS // factor
474473
total_addresses = min(
475474
max_addresses_to_collect, ceil(datetime.now(tz=UTC).hour / factor) + 1
476475
)

0 commit comments

Comments
 (0)