Skip to content

Add server choice to enum generation scripts and improve CozyTouch enums#1965

Merged
iMicknl merged 9 commits intov2/mainfrom
v2/autogen_scripts
Apr 5, 2026
Merged

Add server choice to enum generation scripts and improve CozyTouch enums#1965
iMicknl merged 9 commits intov2/mainfrom
v2/autogen_scripts

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Mar 31, 2026

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] [2]
  • 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] [2] [3] [4]
  • Added command-line argument parsing with argparse, enabling users to select the Overkiz server via the --server flag. [1] [2]

@iMicknl iMicknl added the v2 label Mar 31, 2026
@iMicknl iMicknl marked this pull request as ready for review March 31, 2026 13:30
@iMicknl iMicknl requested a review from tetienne as a code owner March 31, 2026 13:30
Copilot AI review requested due to automatic review settings March 31, 2026 13:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --server CLI argument to utils/generate_enums.py and thread the selected Server through protocol/UI/profile enum generation.
  • Extend generated enums to include Protocol.SONOS and UIWidget.SWIMMING_POOL_ROLLER_SHUTTER, plus hardcoded CozyTouch-specific protocol/widget entries.
  • Automatically format generated enum files via ruff after 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +695 to +701
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,
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@iMicknl iMicknl merged commit 8c9d3fc into v2/main Apr 5, 2026
8 checks passed
@iMicknl iMicknl deleted the v2/autogen_scripts branch April 5, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants