Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve _last_update property #201

Merged

Conversation

fleborne
Copy link
Contributor

The _last_update property of pyluos.Device was set but never used. I propose the following:

  • initialize _last_update to 0.0 instead of time.time() to clearly show that no state has ever been received
  • when a new state is received, set _last_update to the same value as `new_state["timestamp"]
  • create a getter for _last_update

These modifications allow to simply and consistently check how long ago the last state was received.

Copy link
Member

@nicolas-rabault nicolas-rabault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's Nice thank you @fleborne

@nicolas-rabault nicolas-rabault merged commit 724eef2 into Luos-io:rc_3.1.0 Dec 3, 2024
@fleborne fleborne deleted the fix/last_update-management branch December 12, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants