-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add telegram() method to both API versions (#430) #491
base: main
Are you sure you want to change the base?
Conversation
Return type is `Any` because we don't process the response from the API.
Warning Rate limit exceeded@Mausy5043 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 5 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis pull request introduces a new Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
homewizard_energy/homewizard_energy.py (1)
85-88
: Add docstring details to match implementation classes.The docstring should clarify that this method returns unprocessed telegram data and reference the measurement method for parsed data, matching the V1/V2 implementations.
async def telegram(self) -> Any: - """Get the latest telegram.""" + """Return the most recent, valid telegram that was given by the device. + The telegram is not processed in any other form. + If you need parsed data, use the measurement method. + """ raise NotImplementedErrorREADME.md (1)
26-26
: Consider adding telegram method example.The import statement correction looks good. Consider adding an example of using the new
telegram()
method to demonstrate its usage for retrieving raw P1 meter data.from homewizard_energy import HomeWizardEnergyV1 + +# Example of getting raw telegram data +telegram = await api.telegram() +print(telegram) # Raw P1 meter data
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md
(1 hunks)homewizard_energy/homewizard_energy.py
(1 hunks)homewizard_energy/v1/__init__.py
(1 hunks)homewizard_energy/v2/__init__.py
(1 hunks)
🔇 Additional comments (2)
homewizard_energy/v1/__init__.py (1)
59-67
: LGTM! Clean implementation of telegram method.The implementation correctly follows the class patterns and includes clear documentation about the unprocessed nature of the returned data.
homewizard_energy/v2/__init__.py (1)
98-107
: LGTM! Secure implementation with proper authorization.The implementation correctly enforces authorization and follows the class patterns. The docstring clearly explains the unprocessed nature of the returned data.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
homewizard_energy/v1/__init__.py (1)
61-64
: Consider enhancing the docstring with examples and return type info.While the docstring clearly explains the purpose, it could be more helpful by including:
- Example usage
- Expected response structure
- Return type description
"""Return the most recent, valid telegram that was given by the device. The telegram is not processed in any other form. If you need parsed data, use the measurement method. + + Returns: + The raw telegram response from the device. Example: + { + "telegram": "/XMX5LGBBFG1009470632\r\n\r\n1-3:0.2.8(42)\r\n0-0:1.0.0(200308161442W)\r\n..." + } """
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
homewizard_energy/v1/__init__.py
(1 hunks)
🔇 Additional comments (1)
homewizard_energy/v1/__init__.py (1)
59-68
: LGTM! Clean and focused implementation.The implementation correctly follows the class patterns, uses appropriate error handling via the @optional_method decorator, and aligns with the PR objectives by returning unprocessed telegram data.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #491 +/- ##
==========================================
- Coverage 99.14% 97.49% -1.65%
==========================================
Files 9 9
Lines 582 598 +16
Branches 44 45 +1
==========================================
+ Hits 577 583 +6
- Misses 3 13 +10
Partials 2 2 ☔ View full report in Codecov by Sentry. |
This should fix #430.
A new method
telegram()
is added to both API versions v1 and v2.This returns the output of the
api/v1/telegram
andapi/telegram
endpoints respectively.All processing is left to the client. Even the return type is not presumed.
Summary by CodeRabbit
New Features
telegram()
method to retrieve the latest telegram data across different API versions (V1 and V2).supports_telegram()
method to check device support for telegram functionality.Documentation
identify
method for clarity.