Add server choice to enum generation scripts and improve CozyTouch enums#1965
Add server choice to enum generation scripts and improve CozyTouch enums#1965
Conversation
…cript for additional protocol attributes
There was a problem hiding this comment.
Pull request overview
This PR enhances the enum-generation workflow by making the Overkiz target server selectable at runtime, and updates generated enums to support additional CozyTouch/Sonos-related values.
Changes:
- Add
--serverCLI argument toutils/generate_enums.pyand thread the selectedServerthrough protocol/UI/profile enum generation. - Extend generated enums to include
Protocol.SONOSandUIWidget.SWIMMING_POOL_ROLLER_SHUTTER, plus hardcoded CozyTouch-specific protocol/widget entries. - Automatically format generated enum files via
ruffafter generation, and document the enum generation process.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| utils/generate_enums.py | Adds server selection, extends hardcoded protocol/widget merging, and formats generated files via ruff. |
| pyoverkiz/enums/ui.py | Adds SWIMMING_POOL_ROLLER_SHUTTER UI widget enum value. |
| pyoverkiz/enums/protocol.py | Adds SONOS protocol and improves MODBUSLINK comment metadata. |
| docs/contribute.md | Documents enum generation, including the new --server flag and formatting behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| subprocess.run( # noqa: S603 | ||
| ["uv", "run", "ruff", "check", "--fix", "--exit-zero", *generated_files], # noqa: S607 | ||
| check=True, | ||
| ) | ||
| subprocess.run( # noqa: S603 | ||
| ["uv", "run", "ruff", "format", *generated_files], # noqa: S607 | ||
| check=True, |
There was a problem hiding this comment.
ruff check --fix is invoked with --exit-zero, which will mask any remaining (unfixable) violations and makes the generator always succeed even if the generated files still have lint errors. Consider removing --exit-zero (or only using it when you explicitly want a non-failing lint pass) so failures are surfaced when generation produces invalid output.
This pull request adds support for new device types and protocols, and enhances the
utils/generate_enums.pyscript 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:
SONOSto theProtocolenum inpyoverkiz/enums/protocol.py, enabling support for Sonos Cloud Protocol.SWIMMING_POOL_ROLLER_SHUTTERto theUIWidgetenum inpyoverkiz/enums/ui.pyand to the additional UI widgets inutils/generate_enums.py, supporting this device type. [1] [2]MODBUSLINKin theADDITIONAL_PROTOCOLSlist for clarity.Enhancements to the enum generation script:
utils/generate_enums.pyso thatgenerate_protocol_enum,generate_ui_enums,generate_ui_profiles, andgenerate_allaccept aserverargument, allowing the Overkiz server to be specified at runtime. [1] [2] [3] [4]--serverflag. [1] [2]