From a8b5d1511d9624d925c1089a80c9a98e328e68bd Mon Sep 17 00:00:00 2001 From: mvn23 Date: Mon, 30 Jun 2025 20:24:13 +0200 Subject: [PATCH] Populate hvac_modes list in opentherm_gw (#142074) --- homeassistant/components/opentherm_gw/climate.py | 13 ++++++++++++- homeassistant/components/opentherm_gw/strings.json | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/opentherm_gw/climate.py b/homeassistant/components/opentherm_gw/climate.py index 68463e764f2..c7e107b1637 100644 --- a/homeassistant/components/opentherm_gw/climate.py +++ b/homeassistant/components/opentherm_gw/climate.py @@ -21,6 +21,7 @@ from homeassistant.components.climate import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_TEMPERATURE, CONF_ID, UnitOfTemperature from homeassistant.core import HomeAssistant, callback +from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -30,6 +31,7 @@ from .const import ( CONF_SET_PRECISION, DATA_GATEWAYS, DATA_OPENTHERM_GW, + DOMAIN, THERMOSTAT_DEVICE_DESCRIPTION, OpenThermDataSource, ) @@ -75,7 +77,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) _attr_temperature_unit = UnitOfTemperature.CELSIUS - _attr_hvac_modes = [] + _attr_hvac_modes = [HVACMode.HEAT] _attr_name = None _attr_preset_modes = [] _attr_min_temp = 1 @@ -129,9 +131,11 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): if ch_active and flame_on: self._attr_hvac_action = HVACAction.HEATING self._attr_hvac_mode = HVACMode.HEAT + self._attr_hvac_modes = [HVACMode.HEAT] elif cooling_active: self._attr_hvac_action = HVACAction.COOLING self._attr_hvac_mode = HVACMode.COOL + self._attr_hvac_modes = [HVACMode.COOL] else: self._attr_hvac_action = HVACAction.IDLE @@ -182,6 +186,13 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): return PRESET_AWAY return PRESET_NONE + def set_hvac_mode(self, hvac_mode: HVACMode) -> None: + """Set new target hvac mode.""" + raise ServiceValidationError( + translation_domain=DOMAIN, + translation_key="change_hvac_mode_not_supported", + ) + def set_preset_mode(self, preset_mode: str) -> None: """Set the preset mode.""" _LOGGER.warning("Changing preset mode is not supported") diff --git a/homeassistant/components/opentherm_gw/strings.json b/homeassistant/components/opentherm_gw/strings.json index 8959e0facf9..f3938c81e7e 100644 --- a/homeassistant/components/opentherm_gw/strings.json +++ b/homeassistant/components/opentherm_gw/strings.json @@ -355,6 +355,9 @@ } }, "exceptions": { + "change_hvac_mode_not_supported": { + "message": "Changing HVAC mode is not supported." + }, "invalid_gateway_id": { "message": "Gateway {gw_id} not found or not loaded!" }