mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Populate hvac_modes list in opentherm_gw (#142074)
This commit is contained in:
parent
22a14da19c
commit
217fbb2849
@ -21,6 +21,7 @@ from homeassistant.components.climate import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, CONF_ID, UnitOfTemperature
|
from homeassistant.const import ATTR_TEMPERATURE, CONF_ID, UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ from .const import (
|
|||||||
CONF_SET_PRECISION,
|
CONF_SET_PRECISION,
|
||||||
DATA_GATEWAYS,
|
DATA_GATEWAYS,
|
||||||
DATA_OPENTHERM_GW,
|
DATA_OPENTHERM_GW,
|
||||||
|
DOMAIN,
|
||||||
THERMOSTAT_DEVICE_DESCRIPTION,
|
THERMOSTAT_DEVICE_DESCRIPTION,
|
||||||
OpenThermDataSource,
|
OpenThermDataSource,
|
||||||
)
|
)
|
||||||
@ -75,7 +77,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||||
)
|
)
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
_attr_hvac_modes = []
|
_attr_hvac_modes = [HVACMode.HEAT]
|
||||||
_attr_name = None
|
_attr_name = None
|
||||||
_attr_preset_modes = []
|
_attr_preset_modes = []
|
||||||
_attr_min_temp = 1
|
_attr_min_temp = 1
|
||||||
@ -129,9 +131,11 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||||||
if ch_active and flame_on:
|
if ch_active and flame_on:
|
||||||
self._attr_hvac_action = HVACAction.HEATING
|
self._attr_hvac_action = HVACAction.HEATING
|
||||||
self._attr_hvac_mode = HVACMode.HEAT
|
self._attr_hvac_mode = HVACMode.HEAT
|
||||||
|
self._attr_hvac_modes = [HVACMode.HEAT]
|
||||||
elif cooling_active:
|
elif cooling_active:
|
||||||
self._attr_hvac_action = HVACAction.COOLING
|
self._attr_hvac_action = HVACAction.COOLING
|
||||||
self._attr_hvac_mode = HVACMode.COOL
|
self._attr_hvac_mode = HVACMode.COOL
|
||||||
|
self._attr_hvac_modes = [HVACMode.COOL]
|
||||||
else:
|
else:
|
||||||
self._attr_hvac_action = HVACAction.IDLE
|
self._attr_hvac_action = HVACAction.IDLE
|
||||||
|
|
||||||
@ -182,6 +186,13 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||||||
return PRESET_AWAY
|
return PRESET_AWAY
|
||||||
return PRESET_NONE
|
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:
|
def set_preset_mode(self, preset_mode: str) -> None:
|
||||||
"""Set the preset mode."""
|
"""Set the preset mode."""
|
||||||
_LOGGER.warning("Changing preset mode is not supported")
|
_LOGGER.warning("Changing preset mode is not supported")
|
||||||
|
@ -355,6 +355,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exceptions": {
|
"exceptions": {
|
||||||
|
"change_hvac_mode_not_supported": {
|
||||||
|
"message": "Changing HVAC mode is not supported."
|
||||||
|
},
|
||||||
"invalid_gateway_id": {
|
"invalid_gateway_id": {
|
||||||
"message": "Gateway {gw_id} not found or not loaded!"
|
"message": "Gateway {gw_id} not found or not loaded!"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user