Add execute_action_group method and remove other command execution methods.#1862
Merged
Add execute_action_group method and remove other command execution methods.#1862
execute_action_group method and remove other command execution methods.#1862Conversation
Owner
Author
|
I am not a huge fan of how we serialize the models to JSON (and vice-versa) with attrs and humps. We might need to see if moving to pydantic is a cleaner option here. |
9b2bc1e to
7ee723f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors command execution to use a new execute_action_group() method that replaces the existing execute_command() and execute_commands() methods. The refactoring improves type safety, enables concurrent execution across multiple devices, and introduces support for command execution modes (high priority, geolocated, internal).
Key changes:
- Introduced a new serializers module to centralize payload formatting (snake_case to camelCase conversion)
- Refactored the Command class from a dict-based model to an attrs-based class with proper typing and a
to_payload()method - Added
execute_action_group()method with support for CommandMode options
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyoverkiz/serializers.py | New module that handles JSON key formatting (snake_case to camelCase) and special abbreviation fixes like deviceURL |
| pyoverkiz/models.py | Refactored Command class to use attrs with typed parameters supporting OverkizCommandParam enums; updated Action class to accept Command objects and added to_payload methods |
| pyoverkiz/client.py | Replaced execute_command/execute_commands with execute_action_group that supports multiple CommandMode options (high priority, geolocated, internal) |
| tests/test_serializers.py | Added comprehensive tests for payload serialization including nested structures and device URL handling |
| tests/test_models.py | Added tests for Command and Action to_payload methods including None field omission and enum conversion |
| tests/test_client.py | Added test to verify execute_action_group correctly omits None fields and applies proper serialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…h camelCase conversion and omission of None fields
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
78fedac to
d205616
Compare
…ersion to 2.0.0 in uv.lock
Draft
iMicknl
added a commit
that referenced
this pull request
Jan 8, 2026
…methods. (#1862) - `client.execute_command()` and `client.execute_commands()` are replaced by `client.execute_action_group()` - `client.execute_action_group()` now supports multiple execution modes (high priority, internal, geolocated) - `client.execute_action_group()` now supports multiple device actions in the same request The current execution methods are poorly typed and do not support concurrent execution across multiple devices, which makes it impossible to properly work around TooManyExecutionsException and TooManyConcurrentRequestsException. The main change is the move from `client.execute_command()` and `client.execute_commands()` to a single `client.execute_action_group()`. An action group takes a list of actions, each of which can include multiple device actions, including multiple commands per action. ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name="down"), Command(name="refresh") ] ) ], label="Execution via Home Assistant" ) ``` New (mode) options like high priority will be possible now: ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name=OverkizCommand.SET_CLOSURE, parameters=[0]) ] ) ], label="Execution via Home Assistant", mode=CommandMode.HIGH_PRIORITY ) ``` This could serve as a foundation for grouping commands that are executed within a short time window, for example when triggered by a scene or automation in Home Assistant. Requests issued close together could be batched and sent as a single action group, reducing the impact of current Overkiz limitations. The open question is where this queue should live: inside this integration itself, or as part of the Home Assistant core implementation. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
iMicknl
added a commit
that referenced
this pull request
Jan 25, 2026
…methods. (#1862) - `client.execute_command()` and `client.execute_commands()` are replaced by `client.execute_action_group()` - `client.execute_action_group()` now supports multiple execution modes (high priority, internal, geolocated) - `client.execute_action_group()` now supports multiple device actions in the same request The current execution methods are poorly typed and do not support concurrent execution across multiple devices, which makes it impossible to properly work around TooManyExecutionsException and TooManyConcurrentRequestsException. The main change is the move from `client.execute_command()` and `client.execute_commands()` to a single `client.execute_action_group()`. An action group takes a list of actions, each of which can include multiple device actions, including multiple commands per action. ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name="down"), Command(name="refresh") ] ) ], label="Execution via Home Assistant" ) ``` New (mode) options like high priority will be possible now: ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name=OverkizCommand.SET_CLOSURE, parameters=[0]) ] ) ], label="Execution via Home Assistant", mode=CommandMode.HIGH_PRIORITY ) ``` This could serve as a foundation for grouping commands that are executed within a short time window, for example when triggered by a scene or automation in Home Assistant. Requests issued close together could be batched and sent as a single action group, reducing the impact of current Overkiz limitations. The open question is where this queue should live: inside this integration itself, or as part of the Home Assistant core implementation. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
iMicknl
added a commit
that referenced
this pull request
Jan 26, 2026
…methods. (#1862) - `client.execute_command()` and `client.execute_commands()` are replaced by `client.execute_action_group()` - `client.execute_action_group()` now supports multiple execution modes (high priority, internal, geolocated) - `client.execute_action_group()` now supports multiple device actions in the same request The current execution methods are poorly typed and do not support concurrent execution across multiple devices, which makes it impossible to properly work around TooManyExecutionsException and TooManyConcurrentRequestsException. The main change is the move from `client.execute_command()` and `client.execute_commands()` to a single `client.execute_action_group()`. An action group takes a list of actions, each of which can include multiple device actions, including multiple commands per action. ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name="down"), Command(name="refresh") ] ) ], label="Execution via Home Assistant" ) ``` New (mode) options like high priority will be possible now: ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name=OverkizCommand.SET_CLOSURE, parameters=[0]) ] ) ], label="Execution via Home Assistant", mode=CommandMode.HIGH_PRIORITY ) ``` This could serve as a foundation for grouping commands that are executed within a short time window, for example when triggered by a scene or automation in Home Assistant. Requests issued close together could be batched and sent as a single action group, reducing the impact of current Overkiz limitations. The open question is where this queue should live: inside this integration itself, or as part of the Home Assistant core implementation. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
iMicknl
added a commit
that referenced
this pull request
Jan 31, 2026
…methods. (#1862) - `client.execute_command()` and `client.execute_commands()` are replaced by `client.execute_action_group()` - `client.execute_action_group()` now supports multiple execution modes (high priority, internal, geolocated) - `client.execute_action_group()` now supports multiple device actions in the same request The current execution methods are poorly typed and do not support concurrent execution across multiple devices, which makes it impossible to properly work around TooManyExecutionsException and TooManyConcurrentRequestsException. The main change is the move from `client.execute_command()` and `client.execute_commands()` to a single `client.execute_action_group()`. An action group takes a list of actions, each of which can include multiple device actions, including multiple commands per action. ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name="down"), Command(name="refresh") ] ) ], label="Execution via Home Assistant" ) ``` New (mode) options like high priority will be possible now: ```python3 await client.execute_action_group( actions=[ Action( device_url="io://1234-5678-1234/12345678", commands=[ Command(name=OverkizCommand.SET_CLOSURE, parameters=[0]) ] ) ], label="Execution via Home Assistant", mode=CommandMode.HIGH_PRIORITY ) ``` This could serve as a foundation for grouping commands that are executed within a short time window, for example when triggered by a scene or automation in Home Assistant. Requests issued close together could be batched and sent as a single action group, reducing the impact of current Overkiz limitations. The open question is where this queue should live: inside this integration itself, or as part of the Home Assistant core implementation. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Breaking changes
client.execute_command()andclient.execute_commands()are replaced byclient.execute_action_group()Enhancements
client.execute_action_group()now supports multiple execution modes (high priority, internal, geolocated)client.execute_action_group()now supports multiple device actions in the same requestProposal
The current execution methods are poorly typed and do not support concurrent execution across multiple devices, which makes it impossible to properly work around TooManyExecutionsException and TooManyConcurrentRequestsException.
The main change is the move from
client.execute_command()andclient.execute_commands()to a singleclient.execute_action_group(). An action group takes a list of actions, each of which can include multiple device actions, including multiple commands per action.Method examples
New (mode) options like high priority will be possible now:
Next steps
This could serve as a foundation for grouping commands that are executed within a short time window, for example when triggered by a scene or automation in Home Assistant. Requests issued close together could be batched and sent as a single action group, reducing the impact of current Overkiz limitations.
The open question is where this queue should live: inside this integration itself, or as part of the Home Assistant core implementation.