Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions plugwise_usb/nodes/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self, mac, address, message_sender):
self._energy_history_collecting_timestamp = datetime.now()
self._energy_history = {}
self._energy_last_collected_timestamp = datetime(2000, 1, 1)
self._energy_ratelimit_startup_collection_timestamp = datetime(2000, 1, 1)
self._energy_last_rollover_timestamp = datetime(2000, 1, 1)
self._energy_last_local_hour = datetime.now().hour
self._energy_last_populated_slot = 0
Expand Down Expand Up @@ -222,15 +223,13 @@ def request_power_update(self, callback=None):
minute=0, second=0, microsecond=0
):
self.request_energy_counters()
self._energy_last_collected_timestamp = datetime.utcnow().replace(
second=0, microsecond=0
)
else:
# No history collected yet, request energy history
self.request_energy_counters()
self._energy_last_collected_timestamp = datetime.utcnow().replace(
if self._energy_ratelimit_startup_collection_timestamp < datetime.utcnow().replace(
second=0, microsecond=0
)
):
self._energy_ratelimit_startup_collection_timestamp = datetime.utcnow()
self.request_energy_counters()

def message_for_circle(self, message):
"""Process received message
Expand Down