-
Notifications
You must be signed in to change notification settings - Fork 29
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
Small update to home load handling #512
Conversation
…, introduces a sum energy and an helper to be used in homeassistant primarily
… mode, add some tests
Reviewer's Guide by SourceryThis pull request makes a small update to the home load handling in the Sequence DiagramNo sequence diagram generated. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tmenguy - I've reviewed your changes - here's some feedback:
Overall Comments:
- The commit message could be more descriptive. Please provide context on why this change was made and how it improves home load handling.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -179,6 +179,8 @@ async def update( | |||
self.rooms[room["id"]].update(room) | |||
|
|||
for person_status in data.get("persons", []): | |||
# if there is a person update, it means the house has been updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Consider optimizing the has_an_update
flag assignment
The current implementation sets has_an_update = True
for each person update. Consider moving this assignment before the loop for efficiency. Also, review if all person updates truly imply a house update, and ensure the flag is being used effectively in the broader context.
has_an_update = bool(data.get("persons"))
for person_status in data.get("persons", []):
if person := self.persons.get(person_status["id"]):
Installed pre-commit too
Summary by Sourcery
Enhance the home update logic by adding a flag to detect updates when person data changes, and install pre-commit to improve code quality checks.
Enhancements:
Chores: