diff --git a/blog/2025-07-07-water-heater-now-supports-set-a-temp-range.md b/blog/2025-07-07-water-heater-now-supports-set-a-temp-range.md new file mode 100644 index 00000000..59c032f8 --- /dev/null +++ b/blog/2025-07-07-water-heater-now-supports-set-a-temp-range.md @@ -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). diff --git a/docs/core/entity/water-heater.md b/docs/core/entity/water-heater.md index 77a8af5d..b96c1936 100644 --- a/docs/core/entity/water-heater.md +++ b/docs/core/entity/water-heater.md @@ -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 | ## 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`