Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions blog/2025-07-07-water-heater-now-supports-set-a-temp-range.md
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)
Comment on lines +25 to +29
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Code sample contains a typo and missing imports

min_tenp is undeclared; should be min_temp.
Also import Any, ATTR_TARGET_TEMP_LOW, and ATTR_TARGET_TEMP_HIGH to make the snippet copy-pasteable.

-from homeassistant.components.water_heater import WaterHeaterEntity, WaterHeaterEntityFeature
+from typing import Any
+from homeassistant.components.water_heater import (
+    WaterHeaterEntity,
+    WaterHeaterEntityFeature,
+)
+from homeassistant.components.water_heater.const import (
+    ATTR_TARGET_TEMP_LOW,
+    ATTR_TARGET_TEMP_HIGH,
+)

 ...
-        min_temp = kwargs[ATTR_TARGET_TEMP_LOW]
-        max_temp = kwargs[ATTR_TARGET_TEMP_HIGH]
-        self.my_device.set_temperature(min_tenp, max_temp)
+        min_temp = kwargs[ATTR_TARGET_TEMP_LOW]
+        max_temp = kwargs[ATTR_TARGET_TEMP_HIGH]
+        self.my_device.set_temperature(min_temp, max_temp)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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)
from typing import Any
from homeassistant.components.water_heater import (
WaterHeaterEntity,
WaterHeaterEntityFeature,
)
from homeassistant.components.water_heater.const import (
ATTR_TARGET_TEMP_LOW,
ATTR_TARGET_TEMP_HIGH,
)
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_temp, max_temp)
🤖 Prompt for AI Agents
In blog/2025-07-07-water-heater-now-supports-set-a-temp-range.md around lines 25
to 29, fix the typo by replacing the undeclared variable min_tenp with min_temp
in the call to set_temperature. Additionally, add import statements for Any,
ATTR_TARGET_TEMP_LOW, and ATTR_TARGET_TEMP_HIGH at the top of the file to ensure
these identifiers are defined and the code snippet is fully functional.


```

More details can be found in the [water_heater documentation](/docs/core/entity/water-heater#supported-features).
15 changes: 8 additions & 7 deletions docs/core/entity/water-heater.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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   |

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

50-50: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


51-51: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


52-52: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


53-53: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


54-54: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


55-55: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)


56-56: Table pipe style
Expected: leading_only; Actual: leading_and_trailing; Unexpected trailing pipe

(MD055, table-pipe-style)

🤖 Prompt for AI Agents
In docs/core/entity/water-heater.md around lines 50 to 56, the markdown table
uses trailing pipes at the end of each row, which violates the MD055 lint rule.
Remove the trailing pipe character from the end of every row in the table to fix
the violation and ensure consistent rendering.


## 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`

Expand Down