-
Notifications
You must be signed in to change notification settings - Fork 65
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
Voice Assistant Timers #878
Conversation
WalkthroughThe changes introduce a new feature for handling voice assistant timer events within the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant Client
participant Server
participant VoiceAssistant
Client->>Server: send_voice_assistant_timer_event(event_type, timer_id, ...)
Server-->>VoiceAssistant: Notify Timer Event
VoiceAssistant-->>Server: Acknowledge Timer Event
Server-->>Client: VoiceAssistantTimerEventResponse
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Outside diff range and nitpick comments (1)
tests/test_client.py (1)
Line range hint
758-758
: Remove duplicate test function definition.- async def test_valve_command(auth_client: APIClient, cmd: dict[str, Any], req: dict[str, Any]) -> None: - send = patch_send(auth_client) - auth_client.valve_command(**cmd) - send.assert_called_once_with(ValveCommandRequest(**req))This function is defined twice in the file, which could lead to confusion and unexpected behavior during testing. Removing the duplicate will clean up the test suite.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- aioesphomeapi/api.proto (1 hunks)
- aioesphomeapi/client.py (3 hunks)
- aioesphomeapi/core.py (2 hunks)
- aioesphomeapi/model.py (2 hunks)
- tests/test_client.py (3 hunks)
Additional Context Used
Ruff (1)
tests/test_client.py (1)
758-758: Redefinition of unused
test_valve_command
from line 735
Additional comments not posted (7)
aioesphomeapi/core.py (2)
122-122
: The import ofVoiceAssistantTimerEventResponse
is correctly added to support the new functionality.
388-388
: The addition ofVoiceAssistantTimerEventResponse
toMESSAGE_TYPE_TO_PROTO
is correctly implemented to handle the new event type.aioesphomeapi/model.py (1)
1264-1269
: The addition of theVoiceAssistantTimerEventType
enum is correctly implemented and necessary for handling different states of voice assistant timers.aioesphomeapi/api.proto (2)
1539-1544
: The enumVoiceAssistantTimerEvent
is well-defined and follows the established naming conventions.
1546-1557
: The messageVoiceAssistantTimerEventResponse
is correctly structured and uses appropriate data types for its fields.aioesphomeapi/client.py (1)
1391-1408
: The implementation ofsend_voice_assistant_timer_event
method looks correct and aligns with the new feature requirements.Verification successful
The
send_voice_assistant_timer_event
method is correctly integrated and used within the codebase. The related enumVoiceAssistantTimerEventType
and the classVoiceAssistantTimerEventResponse
are also properly defined and utilized.
- The method
send_voice_assistant_timer_event
is used intests/test_client.py
.- The enum
VoiceAssistantTimerEventType
is defined inaioesphomeapi/model.py
.- The class
VoiceAssistantTimerEventResponse
is defined inaioesphomeapi/api_pb2.py
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `send_voice_assistant_timer_event` with the rest of the API. # Test: Search for the method usage and related enum types. Expect: Proper usage and integration. rg --type python $'send_voice_assistant_timer_event'Length of output: 82
Script:
#!/bin/bash # Description: Verify the integration of `send_voice_assistant_timer_event` with the rest of the API. # Test: Search for the method usage and related enum types. Expect: Proper usage and integration. rg 'send_voice_assistant_timer_event' # Test: Search for the definition and usage of the enum `VoiceAssistantTimerEventType`. rg 'VoiceAssistantTimerEventType' # Test: Search for the definition and usage of the class `VoiceAssistantTimerEventResponse`. rg 'VoiceAssistantTimerEventResponse'Length of output: 48666
tests/test_client.py (1)
2492-2514
: Ensure the new test for sending voice assistant timer events is comprehensive.It's good to see that the new functionality for voice assistant timer events is being tested. Consider adding more scenarios to cover edge cases, such as invalid inputs or unexpected server responses.
@coderabbitai The |
Tip For best results, initiate chat on the files or code changes. @jesserockz, thank you for the clarification. I understand that the |
A new one-way event type from HA to device to notify device of its own voice assistant timers.
Summary by CodeRabbit
New Features
Tests