Remove deprecated aux_heat from honeywell (#125248)

This commit is contained in:
G Johansson 2024-09-04 20:28:45 +02:00 committed by GitHub
parent 52320844fc
commit c4029300c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2 additions and 162 deletions

View File

@ -35,11 +35,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import ( from homeassistant.helpers import device_registry as dr, entity_registry as er
device_registry as dr,
entity_registry as er,
issue_registry as ir,
)
from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util.unit_conversion import TemperatureConverter from homeassistant.util.unit_conversion import TemperatureConverter
@ -218,9 +214,6 @@ class HoneywellUSThermostat(ClimateEntity):
if device._data.get("canControlHumidification"): # noqa: SLF001 if device._data.get("canControlHumidification"): # noqa: SLF001
self._attr_supported_features |= ClimateEntityFeature.TARGET_HUMIDITY self._attr_supported_features |= ClimateEntityFeature.TARGET_HUMIDITY
if device.raw_ui_data.get("SwitchEmergencyHeatAllowed"):
self._attr_supported_features |= ClimateEntityFeature.AUX_HEAT
if not device._data.get("hasFan"): # noqa: SLF001 if not device._data.get("hasFan"): # noqa: SLF001
return return
@ -337,11 +330,6 @@ class HoneywellUSThermostat(ClimateEntity):
return PRESET_NONE return PRESET_NONE
@property
def is_aux_heat(self) -> bool | None:
"""Return true if aux heater."""
return self._device.system_mode == "emheat"
@property @property
def fan_mode(self) -> str | None: def fan_mode(self) -> str | None:
"""Return the fan setting.""" """Return the fan setting."""
@ -538,53 +526,6 @@ class HoneywellUSThermostat(ClimateEntity):
else: else:
await self._turn_away_mode_off() await self._turn_away_mode_off()
async def async_turn_aux_heat_on(self) -> None:
"""Turn auxiliary heater on."""
ir.async_create_issue(
self.hass,
DOMAIN,
"service_deprecation",
breaks_in_ha_version="2024.10.0",
is_fixable=True,
is_persistent=True,
severity=ir.IssueSeverity.WARNING,
translation_key="service_deprecation",
)
try:
await self._device.set_system_mode("emheat")
except SomeComfortError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="set_aux_failed",
) from err
async def async_turn_aux_heat_off(self) -> None:
"""Turn auxiliary heater off."""
ir.async_create_issue(
self.hass,
DOMAIN,
"service_deprecation",
breaks_in_ha_version="2024.10.0",
is_fixable=True,
is_persistent=True,
severity=ir.IssueSeverity.WARNING,
translation_key="service_deprecation",
)
try:
if HVACMode.HEAT in self.hvac_modes:
await self.async_set_hvac_mode(HVACMode.HEAT)
else:
await self.async_set_hvac_mode(HVACMode.OFF)
except HomeAssistantError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="disable_aux_failed",
) from err
async def async_update(self) -> None: async def async_update(self) -> None:
"""Get the latest state from the service.""" """Get the latest state from the service."""

View File

@ -88,30 +88,11 @@
"stop_hold_failed": { "stop_hold_failed": {
"message": "Honeywell could not stop hold mode" "message": "Honeywell could not stop hold mode"
}, },
"set_aux_failed": {
"message": "Honeywell could not set system mode to aux heat"
},
"disable_aux_failed": {
"message": "Honeywell could turn off aux heat mode"
},
"switch_failed_off": { "switch_failed_off": {
"message": "Honeywell could turn off emergency heat mode." "message": "Honeywell could turn off emergency heat mode."
}, },
"switch_failed_on": { "switch_failed_on": {
"message": "Honeywell could not set system mode to emergency heat mode." "message": "Honeywell could not set system mode to emergency heat mode."
} }
},
"issues": {
"service_deprecation": {
"title": "Honeywell aux heat is being removed",
"fix_flow": {
"step": {
"confirm": {
"title": "[%key:component::honeywell::issues::service_deprecation::title%]",
"description": "Use `switch.{name}_emergency_heat` instead to change mode.\n\nPlease adjust your automations and scripts and select **submit** to fix this issue."
}
}
}
}
} }
} }

View File

@ -1,7 +1,6 @@
# serializer version: 1 # serializer version: 1
# name: test_static_attributes # name: test_static_attributes
ReadOnlyDict({ ReadOnlyDict({
'aux_heat': 'off',
'current_humidity': 50, 'current_humidity': 50,
'current_temperature': 20, 'current_temperature': 20,
'fan_action': 'idle', 'fan_action': 'idle',
@ -30,7 +29,7 @@
'away', 'away',
'hold', 'hold',
]), ]),
'supported_features': <ClimateEntityFeature: 479>, 'supported_features': <ClimateEntityFeature: 415>,
'target_temp_high': None, 'target_temp_high': None,
'target_temp_low': None, 'target_temp_low': None,
'temperature': None, 'temperature': None,

View File

@ -10,7 +10,6 @@ from syrupy.assertion import SnapshotAssertion
from syrupy.filters import props from syrupy.filters import props
from homeassistant.components.climate import ( from homeassistant.components.climate import (
ATTR_AUX_HEAT,
ATTR_FAN_MODE, ATTR_FAN_MODE,
ATTR_HVAC_MODE, ATTR_HVAC_MODE,
ATTR_PRESET_MODE, ATTR_PRESET_MODE,
@ -22,7 +21,6 @@ from homeassistant.components.climate import (
FAN_ON, FAN_ON,
PRESET_AWAY, PRESET_AWAY,
PRESET_NONE, PRESET_NONE,
SERVICE_SET_AUX_HEAT,
SERVICE_SET_FAN_MODE, SERVICE_SET_FAN_MODE,
SERVICE_SET_HVAC_MODE, SERVICE_SET_HVAC_MODE,
SERVICE_SET_PRESET_MODE, SERVICE_SET_PRESET_MODE,
@ -40,7 +38,6 @@ from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON, SERVICE_TURN_ON,
STATE_UNAVAILABLE,
Platform, Platform,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -221,53 +218,6 @@ async def test_mode_service_calls(
) )
async def test_auxheat_service_calls(
hass: HomeAssistant, device: MagicMock, config_entry: MagicMock
) -> None:
"""Test controlling the auxheat through service calls."""
await init_integration(hass, config_entry)
entity_id = f"climate.{device.name}"
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_AUX_HEAT,
{ATTR_ENTITY_ID: entity_id, ATTR_AUX_HEAT: True},
blocking=True,
)
device.set_system_mode.assert_called_once_with("emheat")
device.set_system_mode.reset_mock()
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_AUX_HEAT,
{ATTR_ENTITY_ID: entity_id, ATTR_AUX_HEAT: False},
blocking=True,
)
device.set_system_mode.assert_called_once_with("heat")
device.set_system_mode.reset_mock()
device.set_system_mode.side_effect = aiosomecomfort.SomeComfortError
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_AUX_HEAT,
{ATTR_ENTITY_ID: entity_id, ATTR_AUX_HEAT: True},
blocking=True,
)
device.set_system_mode.assert_called_once_with("emheat")
device.set_system_mode.reset_mock()
device.set_system_mode.side_effect = aiosomecomfort.SomeComfortError
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_AUX_HEAT,
{ATTR_ENTITY_ID: entity_id, ATTR_AUX_HEAT: False},
blocking=True,
)
async def test_fan_modes_service_calls( async def test_fan_modes_service_calls(
hass: HomeAssistant, device: MagicMock, config_entry: MagicMock hass: HomeAssistant, device: MagicMock, config_entry: MagicMock
) -> None: ) -> None:
@ -1240,37 +1190,6 @@ async def test_async_update_errors(
assert state.state == "unavailable" assert state.state == "unavailable"
async def test_aux_heat_off_service_call(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
device: MagicMock,
config_entry: MagicMock,
) -> None:
"""Test aux heat off turns of system when no heat configured."""
device.raw_ui_data["SwitchHeatAllowed"] = False
device.raw_ui_data["SwitchAutoAllowed"] = False
device.raw_ui_data["SwitchEmergencyHeatAllowed"] = True
await init_integration(hass, config_entry)
entity_id = f"climate.{device.name}"
entry = entity_registry.async_get(entity_id)
assert entry
state = hass.states.get(entity_id)
assert state is not None
assert state.state != STATE_UNAVAILABLE
assert state.state == HVACMode.OFF
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_AUX_HEAT,
{ATTR_ENTITY_ID: entity_id, ATTR_AUX_HEAT: False},
blocking=True,
)
device.set_system_mode.assert_called_once_with("off")
async def test_unique_id( async def test_unique_id(
hass: HomeAssistant, hass: HomeAssistant,
device: MagicMock, device: MagicMock,