Skip to content

Commit 217fbb2

Browse files
authored
Populate hvac_modes list in opentherm_gw (home-assistant#142074)
1 parent 22a14da commit 217fbb2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

homeassistant/components/opentherm_gw/climate.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from homeassistant.config_entries import ConfigEntry
2222
from homeassistant.const import ATTR_TEMPERATURE, CONF_ID, UnitOfTemperature
2323
from homeassistant.core import HomeAssistant, callback
24+
from homeassistant.exceptions import ServiceValidationError
2425
from homeassistant.helpers.dispatcher import async_dispatcher_connect
2526
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
2627

@@ -30,6 +31,7 @@
3031
CONF_SET_PRECISION,
3132
DATA_GATEWAYS,
3233
DATA_OPENTHERM_GW,
34+
DOMAIN,
3335
THERMOSTAT_DEVICE_DESCRIPTION,
3436
OpenThermDataSource,
3537
)
@@ -75,7 +77,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
7577
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
7678
)
7779
_attr_temperature_unit = UnitOfTemperature.CELSIUS
78-
_attr_hvac_modes = []
80+
_attr_hvac_modes = [HVACMode.HEAT]
7981
_attr_name = None
8082
_attr_preset_modes = []
8183
_attr_min_temp = 1
@@ -129,9 +131,11 @@ def receive_report(self, status: dict[OpenThermDataSource, dict]):
129131
if ch_active and flame_on:
130132
self._attr_hvac_action = HVACAction.HEATING
131133
self._attr_hvac_mode = HVACMode.HEAT
134+
self._attr_hvac_modes = [HVACMode.HEAT]
132135
elif cooling_active:
133136
self._attr_hvac_action = HVACAction.COOLING
134137
self._attr_hvac_mode = HVACMode.COOL
138+
self._attr_hvac_modes = [HVACMode.COOL]
135139
else:
136140
self._attr_hvac_action = HVACAction.IDLE
137141

@@ -182,6 +186,13 @@ def preset_mode(self) -> str:
182186
return PRESET_AWAY
183187
return PRESET_NONE
184188

189+
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
190+
"""Set new target hvac mode."""
191+
raise ServiceValidationError(
192+
translation_domain=DOMAIN,
193+
translation_key="change_hvac_mode_not_supported",
194+
)
195+
185196
def set_preset_mode(self, preset_mode: str) -> None:
186197
"""Set the preset mode."""
187198
_LOGGER.warning("Changing preset mode is not supported")

homeassistant/components/opentherm_gw/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@
355355
}
356356
},
357357
"exceptions": {
358+
"change_hvac_mode_not_supported": {
359+
"message": "Changing HVAC mode is not supported."
360+
},
358361
"invalid_gateway_id": {
359362
"message": "Gateway {gw_id} not found or not loaded!"
360363
}

0 commit comments

Comments
 (0)