-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Add target temp range to water_heater
#148222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
3a256c4 to
d5c2443
Compare
|
Hi, |
water_heater
There was a problem hiding this 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 adds target temperature range functionality to the water_heater component, allowing water heaters to specify both high and low target temperature setpoints. This mirrors similar functionality in the climate component and was approved through an architecture discussion. The implementation includes a new TARGET_TEMPERATURE_RANGE entity feature flag, validation to ensure proper feature support, and comprehensive test coverage for both single target temperature and temperature range scenarios.
Key changes:
- Added
TARGET_TEMPERATURE_RANGEfeature flag and related attributes (target_temp_high,target_temp_low) - Updated service schema to support exclusive temperature parameters with proper validation
- Implemented state reproduction logic to handle temperature ranges
- Added comprehensive tests and demo entities
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/water_heater/__init__.py |
Added TARGET_TEMPERATURE_RANGE feature flag, updated schema to support temp ranges with exclusive/inclusive validation, and added service handler validation |
homeassistant/components/water_heater/services.yaml |
Added target_temp_high and target_temp_low fields with appropriate feature filters |
homeassistant/components/water_heater/strings.json |
Added error messages and field descriptions for temperature range parameters |
homeassistant/components/water_heater/reproduce_state.py |
Added logic to reproduce temperature range states alongside single temperature |
homeassistant/components/demo/water_heater.py |
Added demo entity showcasing temperature range functionality |
tests/components/water_heater/test_init.py |
Added comprehensive tests for both target temperature and temperature range scenarios with validation checks |
tests/components/water_heater/test_reproduce_state.py |
Added tests for reproducing water heater states with temperature ranges |
tests/components/water_heater/conftest.py |
Added test fixture for integration setup |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…re thread safety.
…hod in an executor to avoid blocking the event loop.
…sly in the event loop, to avoid thread safety violations with legacy synchronous implementations.
There was a problem hiding this 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 8 out of 8 changed files in this pull request and generated 2 comments.
| def set_temperature(self, **kwargs: Any) -> None: | ||
| """Set new target temperatures.""" | ||
| self._attr_target_temperature = kwargs.get(ATTR_TEMPERATURE) |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The set_temperature method only handles ATTR_TEMPERATURE but doesn't handle ATTR_TARGET_TEMP_HIGH and ATTR_TARGET_TEMP_LOW parameters. The demo entity for temperature range will not work correctly when the service is called. Add handling for these parameters similar to the test mock entities in test_init.py.
| target_temp_high: | ||
| filter: | ||
| supported_features: | ||
| - water_heater.WaterHeaterEntityFeature.TARGET_TEMPERATURE_RANGE | ||
| advanced: true | ||
| selector: |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The target_temp_high and target_temp_low fields are missing the required: true declaration. While they use vol.Inclusive in the schema (which requires both when one is present), the services.yaml should also reflect this requirement for UI clarity. Consider adding required: false explicitly since they are only required together as a pair, not individually.
Proposed change
This PR adds target temperature range functionality to the
water_heatercomponent, allowing water heaters to specify both high and low target temperature setpoints. This mirrors similar functionality in the climate component and was approved through an architecture discussion #995.The implementation includes:
TARGET_TEMPERATURE_RANGEentity feature flag,Key changes:
TODO: Needs a frontend PR
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: