Skip to content

Commit 991743e

Browse files
committed
Implement another CRAI suggestion
1 parent 702af00 commit 991743e

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
@@ -468,7 +468,8 @@ async def _get_initial_energy_logs(self) -> None:
468468

469469
# When only consumption is measured, 1 address contains data from 4 hours
470470
# 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
471+
cons_only = self.energy_production_interval is None
472+
factor = 4 if cons_only else 2
472473
max_addresses_to_collect = MAX_LOG_HOURS // factor
473474
total_addresses = min(
474475
max_addresses_to_collect, ceil(datetime.now(tz=UTC).hour / factor) + 1

0 commit comments

Comments
 (0)