-
Notifications
You must be signed in to change notification settings - Fork 34
Add OverkizClientSettings for RTS default duration and future extensibility #2018
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 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
00a257f
feat: add OverkizClientSettings dataclass (#766)
iMicknl 0753f1b
feat: add Device.get_command_definition() helper (#766)
iMicknl 11f5103
feat: wire OverkizClientSettings into OverkizClient constructor (#766)
iMicknl cc9878a
feat: implement RTS duration injection in execute_action_group (#766)
iMicknl d05b214
Merge branch 'v2/main' into v2/client_settings
iMicknl b7036a9
refactor: replace _rts_command_duration with settings in OverkizClient
iMicknl 265da36
refactor: rename test for RTS device without command definitions
iMicknl 07c21f2
feat: refactor client settings and enhance documentation for action q…
iMicknl 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Behavioral configuration for OverkizClient.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
|
|
||
| from pyoverkiz.action_queue import ActionQueueSettings | ||
|
|
||
|
|
||
| @dataclass(frozen=True, slots=True) | ||
| class OverkizClientSettings: | ||
| """Behavioral configuration for OverkizClient. | ||
|
|
||
| All fields are optional and default to passive behavior. | ||
| """ | ||
|
|
||
| action_queue: ActionQueueSettings | None = None | ||
| rts_command_duration: int | None = None |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| """Tests for OverkizClientSettings.""" | ||
|
|
||
| from pyoverkiz.action_queue import ActionQueueSettings | ||
| from pyoverkiz.client_settings import OverkizClientSettings | ||
|
|
||
|
|
||
| def test_defaults(): | ||
| """Default settings have no queue and no RTS duration.""" | ||
| settings = OverkizClientSettings() | ||
| assert settings.action_queue is None | ||
| assert settings.rts_command_duration is None | ||
|
|
||
|
|
||
| def test_with_rts_duration(): | ||
| """RTS command duration can be set.""" | ||
| settings = OverkizClientSettings(rts_command_duration=0) | ||
| assert settings.rts_command_duration == 0 | ||
|
|
||
|
|
||
| def test_with_action_queue_settings(): | ||
| """Passing ActionQueueSettings stores it directly.""" | ||
| qs = ActionQueueSettings(delay=1.0, max_actions=10) | ||
| settings = OverkizClientSettings(action_queue=qs) | ||
| assert settings.action_queue is qs |
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
Oops, something went wrong.
Oops, something went wrong.
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.