Skip to content

Commit ea6f0c5

Browse files
author
Marc Dirix
committed
replace math.ceil
Use replacement for math.ceil to avoid additional import
1 parent 6b4b379 commit ea6f0c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Plugwise Circle node object."""
22
from datetime import datetime, timedelta
33
import logging
4-
import math
54

65
from ..constants import (
76
FEATURE_ENERGY_CONSUMPTION_TODAY,
@@ -689,7 +688,8 @@ def request_energy_counters(self, log_address=None, callback=None):
689688
hour=0, minute=0, second=0, microsecond=0
690689
) - timedelta(days=1)
691690
)
692-
_log_count = math.ceil(_log_delta.total_seconds()/60/60/4)
691+
_log_count = _log_delta.total_seconds()/60/60/4
692+
_log_count = int(_log_count) + (1 if _log_count - int(_log_count) > 0 else 0)
693693

694694
for req_log_address in range(log_address - _log_count, log_address):
695695
if self._energy_memory.get(req_log_address, 0) < 4:

0 commit comments

Comments
 (0)