Skip to content

Commit

Permalink
Merge pull request #201 from fleborne/fix/last_update-management
Browse files Browse the repository at this point in the history
Improve _last_update property
  • Loading branch information
nicolas-rabault authored Dec 3, 2024
2 parents 7b1ca02 + 8bb1cf0 commit 724eef2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyluos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self, host,
self._setup()
self.logger.info('Device setup.')

self._last_update = time.time()
self._last_update = 0.0
self._running = True
self._pause = False

Expand Down Expand Up @@ -220,6 +220,10 @@ def services(self):
def nodes(self):
return nodeList(self._nodes)

@property
def last_update(self) -> float:
"""The last_update property."""
return self._last_update

# Poll state from hardware.
def _poll_once(self):
Expand Down Expand Up @@ -299,7 +303,7 @@ def _update(self, new_state):
if (self._freedomLink != None):
self._freedomLink._update(alias, mod)

self._last_update = time.time()
self._last_update = float(new_state["timestamp"])

def update_cmd(self, alias, key, val):
with self._cmd_lock:
Expand Down

0 comments on commit 724eef2

Please sign in to comment.