-
Notifications
You must be signed in to change notification settings - Fork 2
Improve EnergyLogs collection #311
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
750d93c
Move energy-log validity-check into energy_log_update()
bouwew 78516e8
Use MAX_LOG_HOUR as in pulses.py
bouwew 0fdf172
Implement CRAI suggestions
bouwew 28769c0
Clean up
bouwew e24a92f
Implement @ArnoutD's idea on how many logs to collect initially
bouwew b689b96
Adapt corresponding log-message
bouwew afb5724
Improve comment
bouwew 8d04842
Stop missing_log collection when None or invalid data is collected
bouwew e9943e6
Remove obsolete _last_collected_energy_timestamp state
bouwew 688014f
CRAI: improve total_addresses calculation
bouwew fff4117
CRAI: improve remaining tasks cancellation
bouwew 40e0179
Docstring, comment improvements
bouwew 60c09d2
Further CRAI tasks cancellation improvement
bouwew d900645
Force division-result to int
bouwew c3a91cb
Retry setting total_addresses
bouwew e6c9050
fixup: improve-energy-collection Python code reformatted using Ruff
bd0195d
Import gather
bouwew 34481b7
Clean up
bouwew 501cfad
Add MAX_ADDRESSES_COLLECTED constant
bouwew b10698c
Update CHANGELOG
bouwew 0e2252a
Correct total_addresses calculation
bouwew 399ffb4
fixup: improve-energy-collection Python code reformatted using Ruff
677f678
Fix typo
bouwew 8378501
Implement CRAI suggestions
bouwew 702af00
Fix typo, improve docstring
bouwew 991743e
Implement another CRAI suggestion
bouwew f6c4d36
Final CRAI suggestions
bouwew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🛠️ Refactor suggestion
Guard against None timestamp in response before updating availability
Other places (e.g., power_update) check for None timestamps. While CircleEnergyLogsResponse may normally include a timestamp, defensively handling None avoids surprises.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
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.
@coderabbitai This protection is not necessary. The response timestamp is always present via the PlugwiseMessage class present in
messages/__init__.py.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.
@bouwew Thank you for the clarification! I understand that the PlugwiseMessage class guarantees that the timestamp is always present, making the defensive guard unnecessary. I appreciate you explaining the underlying behavior of the message structure.
✏️ Learnings added
🧠 Learnings used