Skip to content

Commit 8f8f29e

Browse files
committed
Push circle clock synchronisation into circle.py
add workaround to circle _last_log_address out of sync In logging self.mac => str(self.mac) otherwise sometimes we got a Python error Simplify synchronisation of PowerUpdate and EnergyCounters by changing calling structure _update_energy_today_now Simplify history collection and network occupation on PlugWise startup by calculating missing addresses and calling off one address per PowerUpdate loop Calculate historal addresses based on know combination of address+timestamp+slot. Only call off PowerUpdate if NodePing was successful. Bump beta version
1 parent 141df2d commit 8f8f29e

3 files changed

Lines changed: 172 additions & 264 deletions

File tree

plugwise_usb/__init__.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -598,30 +598,20 @@ def _update_loop(self):
598598
"""
599599
self._run_update_thread = True
600600
_discover_counter = 0
601-
_sync_clock = False
602-
day_of_month = datetime.now().day
603601
try:
604602
while self._run_update_thread:
605-
if datetime.now().day != day_of_month:
606-
day_of_month = datetime.now().day
607-
_sync_clock = True
608603
for mac, device in self._device_nodes.items():
609604
if device:
610605
if device.battery_powered:
611606
# Check availability state of SED's
612607
self._check_availability_of_seds(mac)
608+
elif device.measures_power:
609+
# Request current power usage of those that reply on ping
610+
device.do_ping(device.request_power_update)
613611
else:
614612
# Do ping request for all non SED's
615613
device.do_ping()
616614

617-
if device.measures_power:
618-
# Request current power usage
619-
device.request_power_update()
620-
# Sync internal clock of power measure nodes once a day
621-
if _sync_clock:
622-
device.sync_clock()
623-
_sync_clock = False
624-
625615
# Do a single ping for undiscovered nodes once per 10 update cycles
626616
if _discover_counter == 10:
627617
for mac in self._nodes_not_discovered:

0 commit comments

Comments
 (0)