|
21 | 21 | from homeassistant.config_entries import ConfigEntry |
22 | 22 | from homeassistant.const import ATTR_TEMPERATURE, CONF_ID, UnitOfTemperature |
23 | 23 | from homeassistant.core import HomeAssistant, callback |
| 24 | +from homeassistant.exceptions import ServiceValidationError |
24 | 25 | from homeassistant.helpers.dispatcher import async_dispatcher_connect |
25 | 26 | from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback |
26 | 27 |
|
|
30 | 31 | CONF_SET_PRECISION, |
31 | 32 | DATA_GATEWAYS, |
32 | 33 | DATA_OPENTHERM_GW, |
| 34 | + DOMAIN, |
33 | 35 | THERMOSTAT_DEVICE_DESCRIPTION, |
34 | 36 | OpenThermDataSource, |
35 | 37 | ) |
@@ -75,7 +77,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): |
75 | 77 | ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE |
76 | 78 | ) |
77 | 79 | _attr_temperature_unit = UnitOfTemperature.CELSIUS |
78 | | - _attr_hvac_modes = [] |
| 80 | + _attr_hvac_modes = [HVACMode.HEAT] |
79 | 81 | _attr_name = None |
80 | 82 | _attr_preset_modes = [] |
81 | 83 | _attr_min_temp = 1 |
@@ -129,9 +131,11 @@ def receive_report(self, status: dict[OpenThermDataSource, dict]): |
129 | 131 | if ch_active and flame_on: |
130 | 132 | self._attr_hvac_action = HVACAction.HEATING |
131 | 133 | self._attr_hvac_mode = HVACMode.HEAT |
| 134 | + self._attr_hvac_modes = [HVACMode.HEAT] |
132 | 135 | elif cooling_active: |
133 | 136 | self._attr_hvac_action = HVACAction.COOLING |
134 | 137 | self._attr_hvac_mode = HVACMode.COOL |
| 138 | + self._attr_hvac_modes = [HVACMode.COOL] |
135 | 139 | else: |
136 | 140 | self._attr_hvac_action = HVACAction.IDLE |
137 | 141 |
|
@@ -182,6 +186,13 @@ def preset_mode(self) -> str: |
182 | 186 | return PRESET_AWAY |
183 | 187 | return PRESET_NONE |
184 | 188 |
|
| 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 | + |
185 | 196 | def set_preset_mode(self, preset_mode: str) -> None: |
186 | 197 | """Set the preset mode.""" |
187 | 198 | _LOGGER.warning("Changing preset mode is not supported") |
|
0 commit comments