-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add target temp range to water heater #2720
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
author: G Johansson | ||
authorURL: https://github.com/gjohansson-ST | ||
authorImageURL: https://avatars.githubusercontent.com/u/62932417?v=4 | ||
authorTwitter: GJohansson | ||
title: "Water heater now supports setting a temperature range" | ||
--- | ||
|
||
As of Home Assistant Core 2025.8, the `WaterHeaterEntity` now also supports setting a temperature range in addition to only setting a temperature. | ||
|
||
Entities needs to set the `TARGET_TEMPERATURE_RANGE` supported feature to enable use of setting a target temperature range. | ||
|
||
```python | ||
|
||
from homeassistant.components.water_heater import WaterHeaterEntity, WaterHeaterEntityFeature | ||
|
||
class MyWaterHeater(WaterHeaterEntity): | ||
"""My water heater.""" | ||
|
||
@property | ||
def supported_features(self) -> WaterHeaterEntityFeature: | ||
"""Return the supported features.""" | ||
return WaterHeaterEntityFeature.TARGET_TEMPERATURE_RANGE | ||
|
||
async def async_set_temperature(self, **kwargs: Any) -> None: | ||
"""Set new target temperature.""" | ||
min_temp = kwargs[ATTR_TARGET_TEMP_LOW] | ||
max_temp = kwargs[ATTR_TARGET_TEMP_HIGH] | ||
self.my_device.set_temperature(min_tenp, max_temp) | ||
|
||
``` | ||
|
||
More details can be found in the [water_heater documentation](/docs/core/entity/water-heater#supported-features). |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,18 +47,19 @@ Properties have to follow the units defined in the `temperature_unit`. | |
Supported features are defined by using values in the `WaterHeaterEntityFeature` enum | ||
and are combined using the bitwise or (`|`) operator. | ||
|
||
| Value | Description | | ||
| -------------------- | ------------------------- | | ||
| `TARGET_TEMPERATURE` | Temperature can be set | | ||
| `OPERATION_MODE` | Operation mode can be set | | ||
| `AWAY_MODE` | Away mode can be set | | ||
| `ON_OFF` | Can be turned on or off | | ||
| Value | Description | | ||
| --------------------------- | ------------------------------ | | ||
| `TARGET_TEMPERATURE` | Temperature can be set | | ||
| `OPERATION_MODE` | Operation mode can be set | | ||
| `AWAY_MODE` | Away mode can be set | | ||
| `ON_OFF` | Can be turned on or off | | ||
| `TARGET_TEMPERATURE_RANGE` | Temperature range can be set | | ||
Comment on lines
+50
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix MD055 table-pipe violation Trailing pipes break the markdown-lint rule and can cause inconsistent rendering. Drop the right-hand pipe on every row. -| Value | Description |
-| --------------------------- | ------------------------------ |
-| `TARGET_TEMPERATURE` | Temperature can be set |
-| `OPERATION_MODE` | Operation mode can be set |
-| `AWAY_MODE` | Away mode can be set |
-| `ON_OFF` | Can be turned on or off |
-| `TARGET_TEMPERATURE_RANGE` | Temperature range can be set |
+| Value | Description |
+| --------------------------- | ------------------------------ |
+| `TARGET_TEMPERATURE` | Temperature can be set |
+| `OPERATION_MODE` | Operation mode can be set |
+| `AWAY_MODE` | Away mode can be set |
+| `ON_OFF` | Can be turned on or off |
+| `TARGET_TEMPERATURE_RANGE` | Temperature range can be set |
🧰 Tools🪛 markdownlint-cli2 (0.17.2)50-50: Table pipe style (MD055, table-pipe-style) 51-51: Table pipe style (MD055, table-pipe-style) 52-52: Table pipe style (MD055, table-pipe-style) 53-53: Table pipe style (MD055, table-pipe-style) 54-54: Table pipe style (MD055, table-pipe-style) 55-55: Table pipe style (MD055, table-pipe-style) 56-56: Table pipe style (MD055, table-pipe-style) 🤖 Prompt for AI Agents
|
||
|
||
## Methods | ||
|
||
### `set_temperature` or `async_set_temperature` | ||
|
||
Sets the temperature the water heater should heat water to. | ||
Sets the temperature or temperature range the water heater should heat water to. | ||
|
||
### `set_operation_mode`or `async_set_operation_mode` | ||
|
||
|
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.
Code sample contains a typo and missing imports
min_tenp
is undeclared; should bemin_temp
.Also import
Any
,ATTR_TARGET_TEMP_LOW
, andATTR_TARGET_TEMP_HIGH
to make the snippet copy-pasteable.📝 Committable suggestion
🤖 Prompt for AI Agents