Skip to content

Replace magic number with DhwOperationSetting.VACATION enum#48

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-47
Closed

Replace magic number with DhwOperationSetting.VACATION enum#48
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-47

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 17, 2025

Addresses regression in PR #47 where vacation mode validation used magic number 5 instead of the DhwOperationSetting.VACATION enum introduced in that PR.

Changes

  • Import: Added DhwOperationSetting enum to mqtt_device_control.py
  • Condition check: Replaced if mode_id == 5: with if mode_id == DhwOperationSetting.VACATION:
  • Error messages: Updated validation messages to reference enum value instead of hardcoded 5
  • Docstring: Updated parameter documentation to reference the enum
# Before
if mode_id == 5:  # Vacation mode
    if vacation_days is None:
        raise ParameterValidationError(
            "vacation_days is only valid for vacation mode (mode 5)",
            parameter="vacation_days",
        )

# After
if mode_id == DhwOperationSetting.VACATION:
    if vacation_days is None:
        raise ParameterValidationError(
            f"vacation_days is only valid for vacation mode "
            f"(mode {DhwOperationSetting.VACATION})",
            parameter="vacation_days",
        )

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: eman <19387+eman@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on magic numbers in enumerations module Replace magic number with DhwOperationSetting.VACATION enum Dec 17, 2025
Copilot AI requested a review from eman December 17, 2025 18:04
Base automatically changed from feature/enumerations-module to main December 17, 2025 19:01
@eman eman closed this Dec 17, 2025
@eman eman deleted the copilot/sub-pr-47 branch December 17, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants