-
-
Notifications
You must be signed in to change notification settings - Fork 82
Add port and noise_psk properties to client_base #1352
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1352 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 3222 3228 +6
=========================================
+ Hits 3222 3228 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Could use coverage but if you need it now I can always add it later |
CodSpeed Performance ReportMerging #1352 will not alter performanceComparing Summary
|
WalkthroughAdds two read-only properties to APIClientBase exposing connection parameters: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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)
aioesphomeapi/client_base.py (2)
299-302: Expose port: LGTM. Add a short docstring for clarity.Clear and consistent with existing address/connected_address accessors. Consider a one‑liner docstring to pin semantics (configured port vs. currently connected port).
@property def port(self) -> int: - return self._params.port + """Configured TCP port used to establish the API connection.""" + return self._params.port
303-306: Mark noise_psk as secret and avoid logging.Add a docstring to flag this property as secret; quick repo scan found no logger calls referencing noise_psk.
@property def noise_psk(self) -> str | None: - return self._params.noise_psk + """Noise PSK (secret). Do not log or expose in user-visible output.""" + return self._params.noise_pskLocation: aioesphomeapi/client_base.py:303-306. Other occurrences: aioesphomeapi/connection.py, aioesphomeapi/_frame_helper/noise.py, and tests/ (sample PSKs).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
aioesphomeapi/client_base.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
aioesphomeapi/client_base.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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/test_client.py (2)
1210-1210: Docstring no longer matches the test scopeUpdate to reflect all properties being verified.
- """Test getting the connected address.""" + """Test client properties: connected_address, expected_name, address, port, noise_psk, api_version."""
1215-1216: Optional: add a quick type assertion for portMinor hardening to ensure the property exposes an int.
assert client.port == 6052 + assert isinstance(client.port, int)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/test_client.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
tests/test_client.py
🧬 Code graph analysis (1)
tests/test_client.py (3)
tests/conftest.py (1)
api_client(209-238)aioesphomeapi/client_base.py (7)
connected_address(308-312)expected_name(288-289)expected_name(292-293)address(296-297)port(300-301)noise_psk(304-305)api_version(315-318)aioesphomeapi/model.py (1)
APIVersion(100-102)
🔇 Additional comments (1)
tests/test_client.py (1)
1205-1217: LGTM: new client properties are exercised correctlyAssertions cover connected_address, expected_name, address, port, noise_psk, and api_version as intended.
|
Good timing |
What does this implement/fix?
Make the port and noise PSK available.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome (if applicable):
Checklist:
tests/folder).