Remove deprecated redundant dry and fan modes from zwave_js
climates (#108124)
Remove deprecated redundant dry and fan modes from zwave_js climates
This commit is contained in:
parent
91815ed5f9
commit
c47fb5d161
3 changed files with 1 additions and 137 deletions
|
@ -37,10 +37,9 @@ from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemper
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
|
||||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
from .const import DATA_CLIENT, DOMAIN, LOGGER
|
from .const import DATA_CLIENT, DOMAIN
|
||||||
from .discovery import ZwaveDiscoveryInfo
|
from .discovery import ZwaveDiscoveryInfo
|
||||||
from .discovery_data_template import DynamicCurrentTempClimateDataTemplate
|
from .discovery_data_template import DynamicCurrentTempClimateDataTemplate
|
||||||
from .entity import ZWaveBaseEntity
|
from .entity import ZWaveBaseEntity
|
||||||
|
@ -243,11 +242,6 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
|
||||||
# treat value as hvac mode
|
# treat value as hvac mode
|
||||||
if hass_mode := ZW_HVAC_MODE_MAP.get(mode_id):
|
if hass_mode := ZW_HVAC_MODE_MAP.get(mode_id):
|
||||||
all_modes[hass_mode] = mode_id
|
all_modes[hass_mode] = mode_id
|
||||||
# Dry and Fan modes are in the process of being migrated from
|
|
||||||
# presets to hvac modes. In the meantime, we will set them as
|
|
||||||
# both, presets and hvac modes, to maintain backwards compatibility
|
|
||||||
if mode_id in (ThermostatMode.DRY, ThermostatMode.FAN):
|
|
||||||
all_presets[mode_name] = mode_id
|
|
||||||
else:
|
else:
|
||||||
# treat value as hvac preset
|
# treat value as hvac preset
|
||||||
all_presets[mode_name] = mode_id
|
all_presets[mode_name] = mode_id
|
||||||
|
@ -503,27 +497,6 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
|
||||||
preset_mode_value = self._hvac_presets.get(preset_mode)
|
preset_mode_value = self._hvac_presets.get(preset_mode)
|
||||||
if preset_mode_value is None:
|
if preset_mode_value is None:
|
||||||
raise ValueError(f"Received an invalid preset mode: {preset_mode}")
|
raise ValueError(f"Received an invalid preset mode: {preset_mode}")
|
||||||
# Dry and Fan preset modes are deprecated as of Home Assistant 2023.8.
|
|
||||||
# Please use Dry and Fan HVAC modes instead.
|
|
||||||
if preset_mode_value in (ThermostatMode.DRY, ThermostatMode.FAN):
|
|
||||||
LOGGER.warning(
|
|
||||||
"Dry and Fan preset modes are deprecated and will be removed in Home "
|
|
||||||
"Assistant 2024.2. Please use the corresponding Dry and Fan HVAC "
|
|
||||||
"modes instead"
|
|
||||||
)
|
|
||||||
async_create_issue(
|
|
||||||
self.hass,
|
|
||||||
DOMAIN,
|
|
||||||
f"dry_fan_presets_deprecation_{self.entity_id}",
|
|
||||||
breaks_in_ha_version="2024.2.0",
|
|
||||||
is_fixable=True,
|
|
||||||
is_persistent=True,
|
|
||||||
severity=IssueSeverity.WARNING,
|
|
||||||
translation_key="dry_fan_presets_deprecation",
|
|
||||||
translation_placeholders={
|
|
||||||
"entity_id": self.entity_id,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
await self._async_set_value(self._current_mode, preset_mode_value)
|
await self._async_set_value(self._current_mode, preset_mode_value)
|
||||||
|
|
||||||
|
|
|
@ -151,17 +151,6 @@
|
||||||
"title": "Newer version of Z-Wave JS Server needed",
|
"title": "Newer version of Z-Wave JS Server needed",
|
||||||
"description": "The version of Z-Wave JS Server you are currently running is too old for this version of Home Assistant. Please update the Z-Wave JS Server to the latest version to fix this issue."
|
"description": "The version of Z-Wave JS Server you are currently running is too old for this version of Home Assistant. Please update the Z-Wave JS Server to the latest version to fix this issue."
|
||||||
},
|
},
|
||||||
"dry_fan_presets_deprecation": {
|
|
||||||
"title": "Dry and Fan preset modes will be removed: {entity_id}",
|
|
||||||
"fix_flow": {
|
|
||||||
"step": {
|
|
||||||
"confirm": {
|
|
||||||
"title": "Dry and Fan preset modes will be removed: {entity_id}",
|
|
||||||
"description": "You are using the Dry or Fan preset modes in your entity `{entity_id}`.\n\nDry and Fan preset modes are deprecated and will be removed. Please update your automations to use the corresponding Dry and Fan **HVAC modes** instead.\n\nClick on SUBMIT below once you have manually fixed this issue."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"device_config_file_changed": {
|
"device_config_file_changed": {
|
||||||
"title": "Device configuration file changed: {device_name}",
|
"title": "Device configuration file changed: {device_name}",
|
||||||
"fix_flow": {
|
"fix_flow": {
|
||||||
|
|
|
@ -18,7 +18,6 @@ from homeassistant.components.climate import (
|
||||||
ATTR_MAX_TEMP,
|
ATTR_MAX_TEMP,
|
||||||
ATTR_MIN_TEMP,
|
ATTR_MIN_TEMP,
|
||||||
ATTR_PRESET_MODE,
|
ATTR_PRESET_MODE,
|
||||||
ATTR_PRESET_MODES,
|
|
||||||
ATTR_TARGET_TEMP_HIGH,
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
ATTR_TARGET_TEMP_LOW,
|
ATTR_TARGET_TEMP_LOW,
|
||||||
DOMAIN as CLIMATE_DOMAIN,
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
|
@ -41,10 +40,8 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import issue_registry as ir
|
|
||||||
|
|
||||||
from .common import (
|
from .common import (
|
||||||
CLIMATE_AIDOO_HVAC_UNIT_ENTITY,
|
|
||||||
CLIMATE_DANFOSS_LC13_ENTITY,
|
CLIMATE_DANFOSS_LC13_ENTITY,
|
||||||
CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY,
|
CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY,
|
||||||
CLIMATE_FLOOR_THERMOSTAT_ENTITY,
|
CLIMATE_FLOOR_THERMOSTAT_ENTITY,
|
||||||
|
@ -769,98 +766,3 @@ async def test_thermostat_unknown_values(
|
||||||
state = hass.states.get(CLIMATE_RADIO_THERMOSTAT_ENTITY)
|
state = hass.states.get(CLIMATE_RADIO_THERMOSTAT_ENTITY)
|
||||||
|
|
||||||
assert ATTR_HVAC_ACTION not in state.attributes
|
assert ATTR_HVAC_ACTION not in state.attributes
|
||||||
|
|
||||||
|
|
||||||
async def test_thermostat_dry_and_fan_both_hvac_mode_and_preset(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
client,
|
|
||||||
climate_airzone_aidoo_control_hvac_unit,
|
|
||||||
integration,
|
|
||||||
) -> None:
|
|
||||||
"""Test that dry and fan modes are both available as hvac mode and preset."""
|
|
||||||
state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY)
|
|
||||||
assert state
|
|
||||||
assert state.attributes[ATTR_HVAC_MODES] == [
|
|
||||||
HVACMode.OFF,
|
|
||||||
HVACMode.HEAT,
|
|
||||||
HVACMode.COOL,
|
|
||||||
HVACMode.FAN_ONLY,
|
|
||||||
HVACMode.DRY,
|
|
||||||
HVACMode.HEAT_COOL,
|
|
||||||
]
|
|
||||||
assert state.attributes[ATTR_PRESET_MODES] == [
|
|
||||||
PRESET_NONE,
|
|
||||||
"Fan",
|
|
||||||
"Dry",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
async def test_thermostat_raise_repair_issue_and_warning_when_setting_dry_preset(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
client,
|
|
||||||
climate_airzone_aidoo_control_hvac_unit,
|
|
||||||
integration,
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
|
||||||
"""Test raise of repair issue and warning when setting Dry preset."""
|
|
||||||
client.async_send_command.return_value = {"result": {"status": 1}}
|
|
||||||
|
|
||||||
state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY)
|
|
||||||
assert state
|
|
||||||
|
|
||||||
await hass.services.async_call(
|
|
||||||
CLIMATE_DOMAIN,
|
|
||||||
SERVICE_SET_PRESET_MODE,
|
|
||||||
{
|
|
||||||
ATTR_ENTITY_ID: CLIMATE_AIDOO_HVAC_UNIT_ENTITY,
|
|
||||||
ATTR_PRESET_MODE: "Dry",
|
|
||||||
},
|
|
||||||
blocking=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
issue_id = f"dry_fan_presets_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}"
|
|
||||||
issue_registry = ir.async_get(hass)
|
|
||||||
|
|
||||||
assert issue_registry.async_get_issue(
|
|
||||||
domain=DOMAIN,
|
|
||||||
issue_id=issue_id,
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
"Dry and Fan preset modes are deprecated and will be removed in Home Assistant 2024.2. Please use the corresponding Dry and Fan HVAC modes instead"
|
|
||||||
in caplog.text
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def test_thermostat_raise_repair_issue_and_warning_when_setting_fan_preset(
|
|
||||||
hass: HomeAssistant,
|
|
||||||
client,
|
|
||||||
climate_airzone_aidoo_control_hvac_unit,
|
|
||||||
integration,
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
|
||||||
"""Test raise of repair issue and warning when setting Fan preset."""
|
|
||||||
client.async_send_command.return_value = {"result": {"status": 1}}
|
|
||||||
state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY)
|
|
||||||
assert state
|
|
||||||
|
|
||||||
await hass.services.async_call(
|
|
||||||
CLIMATE_DOMAIN,
|
|
||||||
SERVICE_SET_PRESET_MODE,
|
|
||||||
{
|
|
||||||
ATTR_ENTITY_ID: CLIMATE_AIDOO_HVAC_UNIT_ENTITY,
|
|
||||||
ATTR_PRESET_MODE: "Fan",
|
|
||||||
},
|
|
||||||
blocking=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
issue_id = f"dry_fan_presets_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}"
|
|
||||||
issue_registry = ir.async_get(hass)
|
|
||||||
|
|
||||||
assert issue_registry.async_get_issue(
|
|
||||||
domain=DOMAIN,
|
|
||||||
issue_id=issue_id,
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
"Dry and Fan preset modes are deprecated and will be removed in Home Assistant 2024.2. Please use the corresponding Dry and Fan HVAC modes instead"
|
|
||||||
in caplog.text
|
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue