Skip to content

Commit 18ea6e9

Browse files
committed
Revert "Implement CRAI suggestions"
This reverts commit 9a5cb09.
1 parent 8378501 commit 18ea6e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
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
7879

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

456457
async def _get_initial_energy_logs(self) -> None:
457-
"""Collect initial energy logs for the hours elapsed today up to MAX_LOG_HOURS."""
458+
"""Collect initial energy logs for the hours elapsed today up to MAX_LOG_HOURS ."""
458459
if self._current_log_address is None:
459460
return
460461

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

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

0 commit comments

Comments
 (0)