Skip to content

Rename some constants in Evohome#167462

Closed
zxdavb wants to merge 2 commits into
home-assistant:devfrom
zxdavb:evo_tidy_up
Closed

Rename some constants in Evohome#167462
zxdavb wants to merge 2 commits into
home-assistant:devfrom
zxdavb:evo_tidy_up

Conversation

@zxdavb
Copy link
Copy Markdown
Member

@zxdavb zxdavb commented Apr 5, 2026

Proposed change

This PR simply renames some symbols to reduce possible confusion:

  • specifically, ATTR_* -> EVO_* for some constants

For example, instead of using ATTR_MODE ("mode"), we'll use EVO_MODE ("mode).

  • the former refers to an attribute in the entity schema
  • the latter refers to a kwarg (or named arg) used in native service calls (this specific example is more like a Climate preset)

No breaking change, no end-user visibiliy.

Here is an example of Copilot getting confused: #167359 (comment)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

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 updates the Evohome integration’s internal constant names to reduce ambiguity between Home Assistant “entity attribute” constants and Evohome service/API parameter keys, without changing any user-facing service field names.

Changes:

  • Renamed Evohome integration constants from ATTR_* to EVO_* (string values unchanged).
  • Updated Evohome service schemas/validation and climate service handler code to use the new EVO_* constants.
  • Updated Evohome service tests to use the renamed constants.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/components/evohome/test_services.py Updates service-call payload keys and validation assertions to use EVO_* constants.
homeassistant/components/evohome/services.py Switches service schemas and validator logic to EVO_* constants.
homeassistant/components/evohome/const.py Introduces EVO_* constants (same string values) and removes Evohome-local ATTR_* constants.
homeassistant/components/evohome/climate.py Updates service handling to read mode/period/duration via EVO_* constants.

@zxdavb zxdavb changed the title Rename symbols in evohome Rename some symbols in evohome Apr 5, 2026
@zxdavb zxdavb changed the title Rename some symbols in evohome Rename some symbols in Evohome Apr 5, 2026
@Xirt
Copy link
Copy Markdown
Contributor

Xirt commented Apr 5, 2026

Nice clean-up 👍. A small suggestion is to indicate in the title that this is solely about renaming constants ("symbols" is quite broad). That said: I checked the changes and this looks like a good update to have more consistent naming of constants for this integration without any functional impact. Furthermore, changing ATTR_MODE seems correct, while other (entity specific) constants are left untouched (like ATTR_TEMPERATURE).

@zxdavb zxdavb changed the title Rename some symbols in Evohome Rename some constants in Evohome Apr 6, 2026
@zxdavb zxdavb marked this pull request as draft April 6, 2026 08:46
@zxdavb zxdavb marked this pull request as ready for review April 6, 2026 08:46
Copilot AI review requested due to automatic review settings April 6, 2026 08:46
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 1 comment.

Comment on lines +27 to +28
# These are kwargs and named args for API calls
EVO_DURATION: Final = "duration" # number of minutes, <24h
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Update the inline comment for the EVO_* constants to describe them as Home Assistant service-call field names (parsed via cv.time_period into timedeltas) rather than “kwargs / number of minutes”, since the current wording is misleading about where they’re used and their types.

Suggested change
# These are kwargs and named args for API calls
EVO_DURATION: Final = "duration" # number of minutes, <24h
# These are Home Assistant service-call field names
EVO_DURATION: Final = "duration" # parsed via cv.time_period into a timedelta

Copilot uses AI. Check for mistakes.
Comment thread homeassistant/components/evohome/const.py Outdated
@MartinHjelmare MartinHjelmare marked this pull request as draft April 6, 2026 17:03
@zxdavb zxdavb closed this Apr 6, 2026
@zxdavb zxdavb deleted the evo_tidy_up branch April 6, 2026 21:04
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants