Rename Scenario to ActionGroup (and relevant methods), reuse ActionGroup for Execution typing#1864
Merged
Rename Scenario to ActionGroup (and relevant methods), reuse ActionGroup for Execution typing#1864
Conversation
43a64c0 to
4425094
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR renames the Scenario class to ActionGroup to better reflect its purpose and fixes incorrect typing in the Execution class. The Execution.action_group field is changed from list[dict[str, Any]] to a properly typed ActionGroup object, addressing issue #1860.
Key changes:
- Renamed
Scenarioclass toActionGroupwith updated field optionality (creation_time,metadata,oid/id) - Updated
Execution.action_grouptype fromlist[dict[str, Any]]toActionGroupwith proper initialization - Renamed
client.get_scenarios()method toclient.get_action_groups()
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyoverkiz/models.py | Renamed Scenario to ActionGroup, made creation_time and metadata optional, added dual oid/id support, and updated Execution to use typed ActionGroup instead of dict |
| pyoverkiz/client.py | Renamed get_scenarios() method to get_action_groups() and updated imports from Scenario to ActionGroup |
| tests/test_client.py | Updated test method name from test_get_scenarios to test_get_action_groups and renamed test variables accordingly |
| tests/fixtures/exec/current-tahoma-switch.json | Added new test fixture showing an Execution response with an embedded actionGroup object |
Comments suppressed due to low confidence (1)
pyoverkiz/models.py:628
- The field declarations for
idandoidare marked as required (no default values), but the__init__method allows both to beNoneinitially (lines 635-636). This creates a type inconsistency. Additionally, based on the test fixture intests/fixtures/exec/current-tahoma-switch.json, theactionGroupembedded in an Execution response doesn't include anidoroidfield, which will cause the initialization to fail with the ValueError at line 648 whenActionGroup(**action_group)is called fromExecution.__init__(line 593).
Consider making both id and oid optional in the field declarations to match the actual API responses, or adjust the logic to handle cases where neither field is present in the input data.
id: str = field(repr=obfuscate_id)
creation_time: int | None = None
last_update_time: int | None = None
label: str = field(repr=obfuscate_string)
metadata: str | None = None
shortcut: bool | None = None
notification_type_mask: int | None = None
notification_condition: str | None = None
notification_text: str | None = None
notification_title: str | None = None
actions: list[Action]
oid: str = field(repr=obfuscate_id)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Draft
iMicknl
added a commit
that referenced
this pull request
Jan 8, 2026
…oup for Execution typing (#1864) * Rename scenario to action group * Rename test * Fix docstring formatting in ActionGroup class * Remove unnecessary assertions in ActionGroup initialization
iMicknl
added a commit
that referenced
this pull request
Jan 25, 2026
…oup for Execution typing (#1864) * Rename scenario to action group * Rename test * Fix docstring formatting in ActionGroup class * Remove unnecessary assertions in ActionGroup initialization
iMicknl
added a commit
that referenced
this pull request
Jan 26, 2026
…oup for Execution typing (#1864) * Rename scenario to action group * Rename test * Fix docstring formatting in ActionGroup class * Remove unnecessary assertions in ActionGroup initialization
iMicknl
added a commit
that referenced
this pull request
Jan 31, 2026
…oup for Execution typing (#1864) * Rename scenario to action group * Rename test * Fix docstring formatting in ActionGroup class * Remove unnecessary assertions in ActionGroup initialization
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.
Fixes #1860
Fixes wrong typing in Execution (see https://github.com/home-assistant/core/blob/ee6886dabde435cd82e69dd6cbefa3dbb15d5122/homeassistant/components/overkiz/executor.py#L129-L130).
Breaking changes
client.get_scenarios()is replaced byclient.get_action_groups()Scenario()model is replaced byActionGroup(), wherecreation_timeandmetadata` are now optional fieldsFixes
client.get_current_executions()is now properly typed, previously theExecution()model returned a list type foraction_group, what should be a dict type.