Rename some constants in Evohome#167462
Conversation
There was a problem hiding this comment.
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_*toEVO_*(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. |
|
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). |
| # These are kwargs and named args for API calls | ||
| EVO_DURATION: Final = "duration" # number of minutes, <24h |
There was a problem hiding this comment.
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.
| # 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 |
Proposed change
This PR simply renames some symbols to reduce possible confusion:
ATTR_*->EVO_*for some constantsFor example, instead of using
ATTR_MODE("mode"), we'll useEVO_MODE("mode).No breaking change, no end-user visibiliy.
Here is an example of Copilot getting confused: #167359 (comment)
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: