Conversation
bf67bd1 to
09c7700
Compare
* Bump minimum required Python version to 3.12 * Update CI/CD
…oup for Execution typing (#1864) * Rename scenario to action group * Rename test * Fix docstring formatting in ActionGroup class * Remove unnecessary assertions in ActionGroup initialization
…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>
…ial classes (#1867) - Introduced UsernamePasswordCredentials and LocalTokenCredentials for better credential management. - Updated OverkizClient to utilize the new credential classes and refactored login logic. - Added authentication strategies for various servers, including Somfy and Rexel. - Created new modules for auth strategies and credentials to improve code organization. - Enhanced README with updated usage examples for the new authentication methods. - `OverkizServer` class is renamed to `ServerConfig` and has additional `server` and `type` (cloud/local) property - `generate_local_server` is renamed to `create_local_server_config` - `client.api_type` is removed and now available via `ServerConfig` (e.g. `client.server_config.type`) - The `OverkizClient` constructor now requires passing a `ServerConfig` via `server` - The `OverkizClient` constructur now requires passing an `Credentials` class via `credentials`, e.g. `UsernamePasswordCredentials(USERNAME, PASSWORD)` for most server. - The OverkizClient constructor now supports passing a Server enum directly, such as `OverkizClient(server=Server.SOMFY_EUROPE, ...)`. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: iMicknl <1424596+iMicknl@users.noreply.github.com>
## Enhancement - Publish detailed developer documentation via GitHub Pages [imicknl.github.io/python-overkiz-api](https://imicknl.github.io/python-overkiz-api/). Fixes #190, #1522
…ty (#1917) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixes #1865 --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: iMicknl <1424596+iMicknl@users.noreply.github.com>
# API Documentation Changelog ## Overview This document details all changes made to `docs/api/index.html` in the v2/apiDocs branch compared to v2/main. --- ## 1. Library and Resource Updates ### jQuery Library Versions - **Old**: `jquery-1.10.2.js` and `jquery-1.10.2-ui.js` - **New**: `jquery.min.js` and `jquery-ui.min.js` - **Impact**: Updated to minified versions for better performance ### Stylesheet and Resource Links - Normalized self-closing tags: `/>` → `>` - Updated HTTP charset: `utf-8` → `windows-1252` (in meta tag) --- ## 2. HTML Formatting and Encoding Changes ### HTML Entity Encoding All HTML entity-encoded quotes converted to literal quotes throughout JSON examples: - `"` → `"` - Applied consistently across all JSON sample values in the documentation ### Self-Closing Tag Normalization - `<br/>` → `<br>` - `<link ... />` → `<link ... >` - Applied to all HTML elements in the documentation ### Table Structure - Added `<tbody>` tags to all table elements for proper HTML structure - Added `style="display: none;"` attributes to hidden rows for cleaner display --- ## 3. API Test Links ### URL Updates All test operation links now use absolute URLs instead of relative paths: - **Old**: `href="doc/test/[hash]"` - **New**: `href="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/doc/test/[hash]"` ### Affected Operations Applied to all API operations that include test links: - Create action group - Update action group - Delete action group - Get action groups - Execute action group - And all other endpoints with test functionality --- ## 4. Access Scope Information ### New Access Scope Blocks Added `<pre class="scoped">Access scope : ...</pre>` blocks to API operations: - Full enduser API access (enduser/*) - Enduser Open API (enduser/o) - Applied to all applicable API endpoints ### Example ```html <pre class="scoped">Access scope : Full enduser API access (enduser/*)</pre> ``` --- ## 5. Sample JSON and Default Values ### Action Group Examples #### shortcut Field - **Old**: `"shortcut" : false` - **New**: `"shortcut" : true` #### notificationCondition Field - **Old**: `"notificationCondition" : "ALWAYS"` - **New**: `"notificationCondition" : "ON_SUCCESS"` #### New Field: lockLevel - **Added**: `"lockLevel" : 5` to command parameters - **Location**: Command examples within action groups ### Example Before: ```json { "shortcut" : false, "notificationCondition" : "ALWAYS", "commands" : [ { "delay" : 1 } ] } ``` ### Example After: ```json { "shortcut" : true, "notificationCondition" : "ON_SUCCESS", "commands" : [ { "delay" : 1, "lockLevel" : 5 } ] } ``` --- ## 6. Event Information Updates ### Event Descriptions and Reordering #### GatewaySynchronizationStartedEvent - **Added Fields**: - `"owningPartner" : "an owning partner"` - `"gatewayId" : "A gateway id (ex: 0101-1234-5678)"` #### GatewaySynchronizationEndedEvent - **Added Fields**: - `"owningPartner" : "an owning partner"` - `"gatewayId" : "A gateway id (ex: 0101-1234-5678)"` #### ActionGroupCreatedEvent - **Reordered**: Event appears later in documentation (moved after GatewaySynchronizationStartedEvent) - **Added Fields**: - `"owningPartners" : [ "some owning partners" ]` - **Modified Structure**: Updated JSON example to reflect current API response format #### ActionGroupUpdatedEvent - **New Event**: Added to documentation - **Fields Include**: - `"owningPartners" : [ "some owning partners" ]` - Full action group structure with metadata #### ActionGroupDeletedEvent - **New Event**: Added to documentation - **Fields Include**: - `"owningPartners" : [ "some owning partners" ]` - `"actionGroupOID"` - `"setupOID"` #### ExecutionStateChangedEvent - **Enhanced Fields**: - Added `"owningPartners" : [ "some owning partners" ]` - Added `"failedCommands"` array with detailed error information - Added `"failureTypeCode"` and `"failureType"` fields #### DeviceStateChangedEvent - **Enhanced Fields**: - Added `"owningPartners" : [ "some owning partners" ]` - Updated device state change structure --- ## 7. API Response Examples Updates ### Action Group Response Structure #### Enhanced Fields - **creationTime**: `"creationTime" : 1769503155441` (timestamp added) - **lastUpdateTime**: `"lastUpdateTime" : 1769503155441` (timestamp added) - **lockLevel**: `"lockLevel" : 5` (now included in command examples) ### Execution Response Structure - Updated to include complete execution details - Added fields: `startTime`, `owner`, `actionGroup`, `description`, `executionType`, `executionSubType` --- ## 8. Rate Limiting Information ### Updated Rate Limit Blocks Rate limiting sections now include more detailed information: - Per-session rate limits with specific time periods - Categorized limits (e.g., "bulk-load", "exec") ### Example ```html <pre class="rateLimited">Per-session rate-limit : 1 calls per 1d period for this particular operation (bulk-load)</pre> ``` --- ## 9. Parameter Updates ### New Request Parameters - **preventLockLevelReset**: Added to action group update operations - Type: Boolean (default false) - Description: "Do not reset command lock levels" ### Enhanced Parameter Descriptions - Descriptions now wrapped in `<pre>` tags for consistency - Added optional parameter indicators - More detailed documentation of parameter purposes --- ## 10. Event Field Documentation ### New Event Fields Documented #### owningPartner (singular) - **Type**: String - **Description**: "Owning partner of the parent entity (gateway, setup group, ...)) . only available in event streams" - **Applied to**: GatewaySynchronizationStartedEvent, GatewaySynchronizationEndedEvent #### owningPartners (plural) - **Type**: Array of Strings - **Description**: "Owning partners of the parent entity (setup, ...)) . only available in event streams" - **Applied to**: ActionGroupCreatedEvent, ActionGroupUpdatedEvent, ActionGroupDeletedEvent, ExecutionStateChangedEvent, DeviceStateChangedEvent #### gatewayId - **Type**: String - **Description**: "A gateway id (ex: 0101-1234-5678)" - **Applied to**: Gateway-related events --- ## 11. Content Organization Changes ### Event Reordering Events are now organized in a different order within the documentation: 1. **Create Action Group Operation**: - GatewaySynchronizationStartedEvent (moved first) - ActionGroupCreatedEvent - GatewaySynchronizationEndedEvent 2. **Update Action Group Operation**: - GatewaySynchronizationStartedEvent - GatewaySynchronizationEndedEvent - ActionGroupUpdatedEvent 3. **Delete Action Group Operation**: - GatewaySynchronizationEndedEvent - GatewaySynchronizationStartedEvent - ActionGroupDeletedEvent --- ## 12. Trigger and Execution Documentation ### Delayed Execution Events - Enhanced documentation for `DelayedTriggerSetEvent` - Enhanced documentation for `DelayedTriggerCancelledEvent` - Clearer execution type descriptions ### Weekly Planning - Updated examples for weekly planning triggers - Time-based trigger documentation - Dawn/dusk trigger clarification --- ## 13. Country Data Updates ### New Country Support - **Country**: South Korea - **Code**: KR - Added to all supported countries lists in location-related API operations --- ## Summary of Changes | Category | Change Type | Count | |----------|------------|-------| | Library Updates | Version upgrades | 2 | | HTML Encoding | Entity encoding → literal | ~500+ | | Self-closing Tags | Normalization | ~200+ | | Test Links | URL updates | ~100+ | | Access Scopes | Added blocks | ~50+ | | Event Fields | New fields | 15+ | | Event Events | New/reordered | 10+ | | Sample Values | Updated defaults | 10+ | | Parameters | New parameters | 5+ | | Countries | New entries | 1+ | --- ## Impact Assessment ### For API Users - ✅ Test links now direct to full absolute URLs - ✅ Better documentation of event ownership and access scopes - ✅ New fields provide more context (owningPartner/owningPartners) - ✅ Enhanced error information in ExecutionStateChangedEvent ### For HTML/Browser Rendering - ✅ Proper `<tbody>` tags improve semantic HTML - ✅ Literal quote characters instead of entities improve readability - ✅ Updated jQuery libraries (minified versions) improve performance ### For Backwards Compatibility -⚠️ New event fields should be treated as additions (not breaking) -⚠️ New parameter `preventLockLevelReset` is optional -⚠️ Sample JSON default values changed (may affect test/mock implementations) --- ## Notes for Reviewers When reviewing this file in GitHub: 1. **Use whitespace filtering**: Enable "Hide whitespace" in the diff viewer 2. **Focus on**: - Event field additions and reordering - Sample JSON value changes - New access scope information - Test link URL updates 3. **Skip reviewing**: HTML entity encoding, self-closing tags, and formatting changes (they don't affect functionality) --- Generated: January 27, 2026
## Breaking
- The Device class no longer includes the `id` property, and the
following fields have been moved into `device.identifier.{}`:
`protocol`, `gateway_id`, `device_address`, and `subsystem_id`.
- Device.data_properties has been removed, as it was a non-existent
value.
## Enhancement
- Device class now has helper methods for retrieving the state value,
commands and definition.
- Device class now has an `identifier` property with protocol,
gateway_id, device_address, subsystem_id and base_device_url fields.
- The Device class now includes additional fields (data_properties,
ui_profiles, ui_classifiers, attributes) under device.definition.
## Full changelog
Fixes #1923
This pull request refactors and enhances the device modeling logic in
`pyoverkiz/models.py`, introducing a new `DeviceIdentifier` class to
encapsulate device URL parsing and related properties. It also adds
several helper methods to the `Device`, `States`, `Definition`, and
`CommandDefinitions` classes, improving code clarity and testability.
Extensive new tests are added to ensure the correctness of these helpers
and the new identifier logic.
**Device identifier and URL parsing improvements:**
* Introduced a new `DeviceIdentifier` class to encapsulate parsing and
properties of device URLs, replacing scattered parsing logic and related
fields in the `Device` class. Device URL parsing now raises a
`ValueError` for invalid formats. (`pyoverkiz/models.py`)
* Refactored the `Device` class to use the new `identifier` property
instead of separate protocol, gateway_id, device_address, and
subsystem_id fields. (`pyoverkiz/models.py`)
[[1]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cL186-L194)
[[2]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cL207-R299)
**Helper methods and API enhancements:**
* Added helper methods to `Device`, `States`, `Definition`, and
`CommandDefinitions` classes (e.g., `get_supported_command_name`,
`has_supported_command`, `get_state_value`, `get_state_definition`,
`select`, `has_any`) to simplify common queries and checks.
(`pyoverkiz/models.py`)
[[1]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cL207-R299)
[[2]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cR355-R366)
[[3]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cR409-R418)
[[4]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cR557-R573)
**Testing improvements:**
* Updated and expanded tests to cover the new `DeviceIdentifier` logic,
helper methods, and error handling for invalid device URLs. Added new
test cases for the helper methods in `Device`, `States`, `Definition`,
and `CommandDefinitions`. (`tests/test_client.py`,
`tests/test_models.py`)
[[1]](diffhunk://#diff-0d92063e88430a02df61616c5f16b148b64ac4539d9cb9b8d883d5a23351b110L279-R281)
[[2]](diffhunk://#diff-0adb667cd397bd56edce10eec11e1b10821740a10d72bd148b09645fc9108968L9-R15)
[[3]](diffhunk://#diff-0adb667cd397bd56edce10eec11e1b10821740a10d72bd148b09645fc9108968L154-L170)
[[4]](diffhunk://#diff-0adb667cd397bd56edce10eec11e1b10821740a10d72bd148b09645fc9108968L190-R194)
[[5]](diffhunk://#diff-0adb667cd397bd56edce10eec11e1b10821740a10d72bd148b09645fc9108968R203-R241)
[[6]](diffhunk://#diff-0adb667cd397bd56edce10eec11e1b10821740a10d72bd148b09645fc9108968R273-R374)
**Code cleanup:**
* Removed legacy or redundant fields and parsing logic from the `Device`
class, and improved fallback logic for `ui_class` and `widget`
properties. (`pyoverkiz/models.py`)
[[1]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cL186-L194)
[[2]](diffhunk://#diff-abae13362160dc5f0aff1ba910ffe223a87f52dfda3a77f160ad13a6a9dbc92cL207-R299)
These changes improve the maintainability and usability of the device
modeling code, making it easier to work with device URLs and query
device capabilities in a robust and testable way.
Small changes to the helpers to have better naming and more aligned to what Home Assistant needs --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
## Breaking - Various `UIClass` and `UIWidget` enums have been renamed to proper UPPER_SNAKE_CASE. ## Enhancements - `UIClass`, `UIWidget` and `UIProfile` are now auto-generated. - Enums that include an `Unknown` value now inherit from a shared base class (`UnknownEnumMixin`) to reduce code repetition - Add SDK functions to retrieve device information, including controllable types, devices, `ui_classes`, `ui_classifiers`, `ui_profile`, and `ui_widgets` --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: iMicknl <1424596+iMicknl@users.noreply.github.com>
tetienne
left a comment
There was a problem hiding this comment.
Nice work on this v2 rewrite! The async context manager pattern, strategy/factory auth design, and action queue batching logic are all well-structured. The StrEnum usage is correct for Python 3.12+, and the parametrized fixture tests are thorough.
I went through the codebase with a focus on Python idioms. Some inline comments below, plus a few more that target lines outside the diff:
Blocker: Type annotations don't match runtime behavior
pyoverkiz/models.py:43, 89-96 - Multiple fields annotated str but default to None (e.g. id: str = field(repr=obfuscate_id, default=None), same for city, country, postal_code, address_line1, address_line2, longitude, latitude). Downstream code trusting the annotation will skip None checks. These should be str | None.
Blocker: StateDefinition can crash at runtime
pyoverkiz/models.py:379-383 - If both name and qualified_name are None, self.qualified_name is never assigned, but the class declares qualified_name: str (non-optional) and get_state_definition reads it unconditionally. This will raise AttributeError. I would suggest either raising ValueError in the else branch, or declaring qualified_name: str | None = None.
Suggestion: field() in __init__ parameter defaults
pyoverkiz/models.py:58, 111-118, 721 - field(repr=obfuscate_id, default=None) used as __init__ parameter defaults evaluates to an attrs Attribute object at definition time, not None. If a parameter is ever omitted, the default is the Attribute object. What about using plain None as parameter defaults and keeping field() only on class-level declarations?
Suggestion: __getitem__ should raise KeyError
pyoverkiz/models.py:473-475, 613-615 - CommandDefinitions.__getitem__ and States.__getitem__ return None on miss. Idiomatic Python expects KeyError from __getitem__; a separate get() method can return None. __contains__ (line 471) relies on the current behavior, so it would need updating too.
Suggestion: Simplify bool | None to bool
pyoverkiz/client.py:281 - register_event_listener: bool | None = True. None and False behave identically here. bool = True would be simpler.
Question: Is the manual __init__ pattern on every model intentional?
Every model uses @define(init=False) + hand-written __init__, duplicating every field. Was attrs' built-in init with converters or cattrs considered? For simple models like DataProperty, Partner, Feature, ZoneItem, the manual init adds nothing beyond self.x = x.
| from pyoverkiz.models import ServerConfig | ||
|
|
||
|
|
||
| class BaseAuthStrategy(AuthStrategy): |
There was a problem hiding this comment.
Blocker: AuthStrategy in base.py is a Protocol. Inheriting from a Protocol makes BaseAuthStrategy also a Protocol in the type system, which means mypy/pyright won't enforce that concrete subclasses implement all required methods.
Two options:
- Remove the inheritance entirely. Structural subtyping means
BaseAuthStrategyalready satisfies theAuthStrategyprotocol without inheriting from it. - Convert
AuthStrategyfromProtocoltoABCif you want explicit runtime inheritance.
Option 1 is simpler and more idiomatic for a Protocol-based design. Worth considering?
…ums (#1965) This pull request adds support for new device types and protocols, and enhances the `utils/generate_enums.py` script by making the Overkiz server configurable via a command-line argument. The main changes include new enum values for Sonos protocol and Swimming Pool Roller Shutter, as well as refactoring the enum generation functions to accept a server parameter. **Support for new device types and protocols:** * Added `SONOS` to the `Protocol` enum in `pyoverkiz/enums/protocol.py`, enabling support for Sonos Cloud Protocol. * Added `SWIMMING_POOL_ROLLER_SHUTTER` to the `UIWidget` enum in `pyoverkiz/enums/ui.py` and to the additional UI widgets in `utils/generate_enums.py`, supporting this device type. [[1]](diffhunk://#diff-368d6a95e10b422ae141b6d3169398def418a225f93d9077d460d25c0ee84c2dR404) [[2]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3R37-R50) * Added a comment for `MODBUSLINK` in the `ADDITIONAL_PROTOCOLS` list for clarity. **Enhancements to the enum generation script:** * Refactored `utils/generate_enums.py` so that `generate_protocol_enum`, `generate_ui_enums`, `generate_ui_profiles`, and `generate_all` accept a `server` argument, allowing the Overkiz server to be specified at runtime. [[1]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3R37-R50) [[2]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3L116-R127) [[3]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3L244-R255) [[4]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3L683-R718) * Added command-line argument parsing with argparse, enabling users to select the Overkiz server via the `--server` flag. [[1]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3R7) [[2]](diffhunk://#diff-19b8541931ee689b317ebeae0e939ee362e28975b186431fbbbdf93abf1ad1a3L683-R718)
Apply feedback form @tetienne in #1872. Feedback on models.py skipped for now, as this will require a larger refactor (like https://github.com/iMicknl/python-overkiz-api/pulls).
Implement feedback from #1931
…by default) (#1975) This pull request updates the `get_diagnostic_data` method in the `pyoverkiz` client to allow users to optionally retrieve unmasked diagnostic data, and adds comprehensive tests to ensure the new behavior works as intended. By default, sensitive data is still masked, but users can now explicitly request the raw data if needed. **Enhancements to diagnostic data retrieval:** * The `get_diagnostic_data` method in `pyoverkiz/client.py` now accepts a `mask_sensitive_data` parameter (defaulting to `True`), allowing callers to choose whether to receive masked (redacted) or raw diagnostic data. The method's docstring has been updated to reflect this new behavior. **Testing improvements:** * Added `test_get_diagnostic_data_redacted_by_default` to verify that diagnostic data is masked by default and that the obfuscation function is called. * Added `test_get_diagnostic_data_without_masking` to ensure that when `mask_sensitive_data=False` is passed, the raw diagnostic data is returned and the obfuscation function is not called.
…r module (#1977) ## Breaking change - OverkizClient.check_response was removed and replaced with the module-level `pyoverkiz.response_handler.check_response`
Rename all custom exception classes to use the Error suffix per PEP 8 naming conventions (ruff N818). Also fix typo NotSuchTokenException to NoSuchTokenError. Enable pep8-naming (N) ruff rules. ## Breaking All custom exception classes have been renamed from *Exception to *Error to follow PEP 8 naming conventions (e.g. NotAuthenticatedException → NotAuthenticatedError). Additionally, NotSuchTokenException has been fixed to NoSuchTokenError (typo fix). --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
## Summary - Replaces the `pyhumps` dependency with a lightweight internal `_case.py` module for camelCase/snake_case conversion - Extracts shared `recursive_key_map` helper and caches `_decamelize_key` for performance - One fewer runtime dependency ## Benchmark | Metric | `pyoverkiz._case` | `pyhumps` | Improvement | |---|---|---|---| | **Import time** | 0.12 ms | 0.28 ms | **2.3x faster** | | **Package size** | 1.2 KB | 19.9 KB | **94% smaller** | | **Decamelize** | 0.28 ms/call | 2.32 ms/call | **8.4x faster** | | **Camelize** | 0.2 µs/call | 0.8 µs/call | **3.6x faster** | | **Correctness** | All 25 fixtures match | — | **100% identical** | ## Test plan - [x] Existing serialization tests pass - [x] New `test_case.py` unit tests cover edge cases - [x] Verify camelCase ↔ snake_case round-trips match pyhumps behavior
…ce code duplication
## Summary - Adds `AuthContext.update_from_token` for shared OAuth token handling across auth strategies - Lazy-imports `boto3` and `warrant-lite` in NexityAuthStrategy so they're only loaded when actually needed - Users who don't use Nexity no longer pay the boto3 import cost ## Test plan - [x] Nexity auth tests pass - [x] Other auth strategies unaffected - [x] Verify boto3 is not imported at module load time
## Summary - Rename `ServerConfig.type` to `ServerConfig.api_type` to avoid shadowing the Python builtin `type` - Update all references in `client.py`, `auth/factory.py`, and tests ## Test plan - [x] All 280 tests pass - [x] ruff, mypy, ty all pass
…across cloud and local servers
## Summary - Rename `CommandMode` → `ExecutionMode` and `cancel_command` → `cancel_execution` - Rename `execute_scenario` → `execute_persisted_action_group` and `execute_scheduled_scenario` → `schedule_persisted_action_group` - Improve documentation for command execution concepts (core-concepts, device-control) - Update method docstrings across client, action queue, and models ## Breaking - `CommandMode` renamed to `ExecutionMode`, `cancel_command()` renamed to `cancel_execution()`, `execute_scenario()` renamed to `execute_persisted_action_group()`, `execute_scheduled_scenario()` renamed to `schedule_persisted_action_group()` --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
## Summary - Use tuples for `pytest.mark.parametrize` argument names (PT006) - Narrow `pytest.raises` blocks to contain only the raising statement (PT012) ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass
## Summary - Add 15 new ruff rule sets that require no code changes: W, LOG, DTZ, FLY, ISC, PGH, SLF, SLOT, TID, INP, ICN, G, BLE, TRY, Q - Ignore TRY003 globally (long exception messages are idiomatic for domain-specific errors) - Add per-file ignores for tests (SLF001) and utils (INP001, BLE001) - Add noqa for intentional blind except in ActionQueue worker ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass - [x] `mypy` passes
## Summary - Replace ternary with `or` operator (FURB110) - Use list comprehension instead of append loop (PERF401) - Remove unnecessary parentheses on raise (RSE102) - Remove explicit `return None` and unnecessary `else` after `return` (RET) - Remove unnecessary `pass` and dict spread (PIE) ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass
- Add TAHOMA_BOX_C_IO enum entry with value 17 (was commented out with conflicting value 12, which is already used by another entry) - Remove unreachable test case (204 is treated as success by the response handler, so the error fixture can never trigger) - Reword format comment to avoid false positive detection
## Summary - Use `Self` return type for `__aenter__` (PYI034) - Simplify `int | float` to `float` in type hints (PYI041) ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass - [x] `mypy` passes
## Summary - Replace `os.path` usage with `pathlib.Path` in `test_client.py` and `mask_fixtures.py` - Remove `os` import where no longer needed ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass
## Summary - Add flake8-builtins rule set with A002 globally ignored (model parameters like `id`, `type` intentionally match Overkiz API field names) - Rename shadowed `input` variable in `test_obfuscate.py` ## Test plan - [x] `ruff check .` passes - [x] `pytest` — 280 tests pass
- Add targeted ignores for API model patterns (too many args, lazy imports, many returns) - Allow magic values in tests and complex logic in utils - Suppress PLR2004 for HTTP status code and JWT segment comparisons
Use http.HTTPStatus instead of raw integers for status code comparisons, eliminating all PLR2004 noqa suppressions.
## Summary
- Fix `get_current_execution` crashing on empty responses (cloud returns
`{}`, local returns `[]` or `null`)
- Make `ActionGroup.id` and `ActionGroup.oid` optional (`str | None`) —
inline action groups from `exec/current` don't carry identifiers
- Add `start_time`, `execution_type`, and `execution_sub_type` fields to
`Execution` model (matching real API responses)
- Change `Execution.state` from `str` to `ExecutionState` enum
(consistent with `HistoryExecution`)
- Add `NoSuchDeviceError` and `NoSuchActionGroupError` exception types
with response handler mappings
- Add 8 new cloud exception fixture tests and 6 new cloud exception JSON
fixtures
- Add 13 cloud client tests covering executions, history, state, places,
action groups, and event listeners
- Add 10 local API tests verifying proper error handling for KizOs
gateway differences
## Breaking changes
- `Execution.state` is now `ExecutionState` instead of `str`,
`ActionGroup.id` and `ActionGroup.oid` are now `str | None` instead of
`str`, `get_current_execution` now returns `Execution | None` instead of
`Execution`
## Test plan
- [x] All 311 unit tests pass
- [x] All prek checks pass (ruff, mypy, ty)
- [x] Validated against real Somfy cloud API (37/37 probes pass)
- [x] Validated against real local KizOs gateway (37/37 probes pass)
- [x] JSON fixtures verified against real API response structures
Breaking changes
client.get_scenarios()is replaced byclient.get_action_groups()(Rename Scenario to ActionGroup (and relevant methods), reuse ActionGroup for Execution typing #1864)Scenario()model is replaced byActionGroup(), wherecreation_timeandmetadata` are now optional fields (Rename Scenario to ActionGroup (and relevant methods), reuse ActionGroup for Execution typing #1864)client.execute_command()andclient.execute_commands()are replaced byclient.execute_action_group()Addexecute_action_groupmethod and remove other command execution methods. #1862OverkizServerclass is renamed toServerConfigand has additionalserverandapi_type(cloud/local) property Refactor authentication handling in OverkizClient and add new credential classes #1867generate_local_serveris renamed tocreate_local_server_configRefactor authentication handling in OverkizClient and add new credential classes #1867client.api_typeis removed and now available viaServerConfig(e.g.client.server_config.api_type) Refactor authentication handling in OverkizClient and add new credential classes #1867OverkizClientconstructor now requires passing aServerConfigviaserverRefactor authentication handling in OverkizClient and add new credential classes #1867OverkizClientconstructur now requires passing anCredentialsclass viacredentials, e.g.UsernamePasswordCredentials(USERNAME, PASSWORD)for most server. Refactor authentication handling in OverkizClient and add new credential classes #1867idproperty, and the following fields have been moved intodevice.identifier.{}:protocol,gateway_id,device_address, andsubsystem_id. Improve Device model #1930UIClassandUIWidgetenums have been renamed to proper UPPER_SNAKE_CASE. Improve enum structure #1925CommandModerenamed toExecutionMode,cancel_command()renamed tocancel_execution(),execute_scenario()renamed toexecute_persisted_action_group(),execute_scheduled_scenario()renamed toschedule_persisted_action_group()Rename CommandMode, cancel_command, and scenario methods #1997Execution.stateis nowExecutionStateinstead ofstr,ActionGroup.idandActionGroup.oidare nowstr | Noneinstead ofstr,get_current_executionnow returnsExecution | Noneinstead ofExecutionImprove error handling and add comprehensive client tests #2007Fixes
client.get_current_executions()is now properly typed, previously theExecution()model returned a list type foraction_group, what should be a dict type. (Rename Scenario to ActionGroup (and relevant methods), reuse ActionGroup for Execution typing #1864)get_current_executioncrashing on empty responses (cloud returns{}, local returns[]ornull) Improve error handling and add comprehensive client tests #2007Features
client.execute_action_group()now supports multiple execution modes (high priority, internal, geolocated) Addexecute_action_groupmethod and remove other command execution methods. #1862client.execute_action_group()now supports multiple device actions in the same request Addexecute_action_groupmethod and remove other command execution methods. #1862OverkizClient(server=Server.SOMFY_EUROPE, ...). Refactor authentication handling in OverkizClient and add new credential classes #1867identifierproperty with protocol, gateway_id, device_address, subsystem_id and base_device_url fields. Improve Device model #1930UIClass,UIWidgetandUIProfileare now auto-generated based on server definitions. Improve enum structure #1925Unknownvalue now inherit from a shared base class (UnknownEnumMixin) to reduce code repetition. Improve enum structure #1925ui_classes,ui_classifiers,ui_profile, andui_widgets. Improve enum structure #1925start_time,execution_type, andexecution_sub_typefields toExecutionmodel Improve error handling and add comprehensive client tests #2007NoSuchDeviceErrorandNoSuchActionGroupErrorexception types Improve error handling and add comprehensive client tests #2007Docs