mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Partially revert #103807: Remove deprecated aux heat support from ESPHome climate entities (#104694)
This commit is contained in:
parent
6dc818b682
commit
d9c0acc1d2
@ -173,8 +173,6 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
|
||||
features |= ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
if self._static_info.supports_target_humidity:
|
||||
features |= ClimateEntityFeature.TARGET_HUMIDITY
|
||||
if self._static_info.supports_aux_heat:
|
||||
features |= ClimateEntityFeature.AUX_HEAT
|
||||
if self.preset_modes:
|
||||
features |= ClimateEntityFeature.PRESET_MODE
|
||||
if self.fan_modes:
|
||||
@ -272,12 +270,6 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
|
||||
"""Return the humidity we try to reach."""
|
||||
return round(self._state.target_humidity)
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def is_aux_heat(self) -> bool:
|
||||
"""Return the auxiliary heater state."""
|
||||
return self._state.aux_heat
|
||||
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature (and operation mode if set)."""
|
||||
data: dict[str, Any] = {"key": self._key}
|
||||
@ -326,11 +318,3 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
|
||||
await self._client.climate_command(
|
||||
key=self._key, swing_mode=_SWING_MODES.from_hass(swing_mode)
|
||||
)
|
||||
|
||||
async def async_turn_aux_heat_on(self) -> None:
|
||||
"""Turn auxiliary heater on."""
|
||||
await self._client.climate_command(key=self._key, aux_heat=True)
|
||||
|
||||
async def async_turn_aux_heat_off(self) -> None:
|
||||
"""Turn auxiliary heater off."""
|
||||
await self._client.climate_command(key=self._key, aux_heat=False)
|
||||
|
@ -15,7 +15,6 @@ from aioesphomeapi import (
|
||||
)
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_AUX_HEAT,
|
||||
ATTR_CURRENT_HUMIDITY,
|
||||
ATTR_FAN_MODE,
|
||||
ATTR_HUMIDITY,
|
||||
@ -29,7 +28,6 @@ from homeassistant.components.climate import (
|
||||
ATTR_TEMPERATURE,
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
FAN_HIGH,
|
||||
SERVICE_SET_AUX_HEAT,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
@ -39,7 +37,7 @@ from homeassistant.components.climate import (
|
||||
SWING_BOTH,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_ON
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
@ -321,68 +319,6 @@ async def test_climate_entity_with_step_and_target_temp(
|
||||
mock_client.climate_command.reset_mock()
|
||||
|
||||
|
||||
async def test_climate_entity_with_aux_heat(
|
||||
hass: HomeAssistant, mock_client: APIClient, mock_generic_device_entry
|
||||
) -> None:
|
||||
"""Test a generic climate entity with aux heat."""
|
||||
entity_info = [
|
||||
ClimateInfo(
|
||||
object_id="myclimate",
|
||||
key=1,
|
||||
name="my climate",
|
||||
unique_id="my_climate",
|
||||
supports_current_temperature=True,
|
||||
supports_two_point_target_temperature=True,
|
||||
supports_action=True,
|
||||
visual_min_temperature=10.0,
|
||||
visual_max_temperature=30.0,
|
||||
supports_aux_heat=True,
|
||||
)
|
||||
]
|
||||
states = [
|
||||
ClimateState(
|
||||
key=1,
|
||||
mode=ClimateMode.HEAT,
|
||||
action=ClimateAction.HEATING,
|
||||
current_temperature=30,
|
||||
target_temperature=20,
|
||||
fan_mode=ClimateFanMode.AUTO,
|
||||
swing_mode=ClimateSwingMode.BOTH,
|
||||
aux_heat=True,
|
||||
)
|
||||
]
|
||||
user_service = []
|
||||
await mock_generic_device_entry(
|
||||
mock_client=mock_client,
|
||||
entity_info=entity_info,
|
||||
user_service=user_service,
|
||||
states=states,
|
||||
)
|
||||
state = hass.states.get("climate.test_myclimate")
|
||||
assert state is not None
|
||||
assert state.state == HVACMode.HEAT
|
||||
attributes = state.attributes
|
||||
assert attributes[ATTR_AUX_HEAT] == STATE_ON
|
||||
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_AUX_HEAT,
|
||||
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_AUX_HEAT: False},
|
||||
blocking=True,
|
||||
)
|
||||
mock_client.climate_command.assert_has_calls([call(key=1, aux_heat=False)])
|
||||
mock_client.climate_command.reset_mock()
|
||||
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_AUX_HEAT,
|
||||
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_AUX_HEAT: True},
|
||||
blocking=True,
|
||||
)
|
||||
mock_client.climate_command.assert_has_calls([call(key=1, aux_heat=True)])
|
||||
mock_client.climate_command.reset_mock()
|
||||
|
||||
|
||||
async def test_climate_entity_with_humidity(
|
||||
hass: HomeAssistant, mock_client: APIClient, mock_generic_device_entry
|
||||
) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user