From 56b347194f6809995a522424840ea507bb9ec4a6 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 13:47:33 +0000 Subject: [PATCH 01/16] Create repair issue instead of warning log Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 19 +++++++++++--- .../components/zwave_js/strings.json | 4 +++ tests/components/zwave_js/test_climate.py | 25 +++++++++++-------- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index f38508ec09c78..bafcb70b82f60 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -36,9 +36,10 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect 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 .const import DATA_CLIENT, DOMAIN, LOGGER +from .const import DATA_CLIENT, DOMAIN from .discovery import ZwaveDiscoveryInfo from .discovery_data_template import DynamicCurrentTempClimateDataTemplate from .entity import ZWaveBaseEntity @@ -526,10 +527,20 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: # Dry and Fan preset modes are deprecated as of 2023.8 # 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 a future release. " - "Use the corresponding Dry and Fan HVAC modes instead" + async_create_issue( + self.hass, + DOMAIN, + f"{preset_mode.lower()}_preset_deprecation_{self.entity_id}", + is_fixable=False, + is_persistent=True, + severity=IssueSeverity.WARNING, + translation_key="dry_fan_presets_deprecation", + translation_placeholders={ + "entity_id": self.entity_id, + "preset_name": preset_mode, + }, ) + await self._async_set_value(self._current_mode, preset_mode_value) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index 0bcb209a760f7..5230664dae2b4 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -150,6 +150,10 @@ "invalid_server_version": { "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." + }, + "dry_fan_presets_deprecation": { + "title": "{preset_name} preset mode will be removed: {entity_id}", + "description": "You are getting this issue because you are using the {preset_name} preset mode in your entity `{entity_id}`.\n\nDry and Fan preset modes are deprecated and will be removed in a future version of Home Assistant. To fix this issue, please update your automations to use the corresponding Dry and Fan **HVAC modes** instead." } } } diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index 753c107c2ee07..a312a8b60218d 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -40,6 +40,7 @@ ATTR_TEMPERATURE, ) from homeassistant.core import HomeAssistant +from homeassistant.helpers import issue_registry as ir from .common import ( CLIMATE_AIDOO_HVAC_UNIT_ENTITY, @@ -722,14 +723,14 @@ async def test_thermostat_dry_and_fan_both_hvac_mode_and_preset( ] -async def test_thermostat_warning_when_setting_dry_preset( +async def test_thermostat_raise_repair_issue_when_setting_dry_preset( hass: HomeAssistant, client, climate_airzone_aidoo_control_hvac_unit, integration, caplog: pytest.LogCaptureFixture, ) -> None: - """Test warning when setting Dry preset.""" + """Test raise of repair issue when setting Dry preset.""" state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state @@ -743,20 +744,22 @@ async def test_thermostat_warning_when_setting_dry_preset( blocking=True, ) - assert ( - "Dry and Fan preset modes are deprecated and will be removed in a future release. Use the corresponding Dry and Fan HVAC modes instead" - in caplog.text + issue_id = f"dry_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + issue_registry = ir.async_get(hass) + assert issue_registry.async_get_issue( + domain=DOMAIN, + issue_id=issue_id, ) -async def test_thermostat_warning_when_setting_fan_preset( +async def test_thermostat_raise_repair_issue_when_setting_fan_preset( hass: HomeAssistant, client, climate_airzone_aidoo_control_hvac_unit, integration, caplog: pytest.LogCaptureFixture, ) -> None: - """Test warning when setting Fan preset.""" + """Test raise of repair issue when setting Fan preset.""" state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state @@ -770,7 +773,9 @@ async def test_thermostat_warning_when_setting_fan_preset( blocking=True, ) - assert ( - "Dry and Fan preset modes are deprecated and will be removed in a future release. Use the corresponding Dry and Fan HVAC modes instead" - in caplog.text + issue_id = f"fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + issue_registry = ir.async_get(hass) + assert issue_registry.async_get_issue( + domain=DOMAIN, + issue_id=issue_id, ) From 14f51611c2077265fbc412a451e09fe18836a083 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 13:57:30 +0000 Subject: [PATCH 02/16] Use the same issue id for both dry and fan presets Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 3 +-- homeassistant/components/zwave_js/strings.json | 4 ++-- tests/components/zwave_js/test_climate.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index bafcb70b82f60..ed44ecb1f6718 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -530,14 +530,13 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: async_create_issue( self.hass, DOMAIN, - f"{preset_mode.lower()}_preset_deprecation_{self.entity_id}", + f"dry_fan_preset_deprecation_{self.entity_id}", is_fixable=False, is_persistent=True, severity=IssueSeverity.WARNING, translation_key="dry_fan_presets_deprecation", translation_placeholders={ "entity_id": self.entity_id, - "preset_name": preset_mode, }, ) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index 5230664dae2b4..580aa6ecc41a6 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -152,8 +152,8 @@ "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": "{preset_name} preset mode will be removed: {entity_id}", - "description": "You are getting this issue because you are using the {preset_name} preset mode in your entity `{entity_id}`.\n\nDry and Fan preset modes are deprecated and will be removed in a future version of Home Assistant. To fix this issue, please update your automations to use the corresponding Dry and Fan **HVAC modes** instead." + "title": "Dry and Fan preset modes will be removed: {entity_id}", + "description": "You are getting this issue because 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 in a future version of Home Assistant. To fix this issue, please update your automations to use the corresponding Dry and Fan **HVAC modes** instead." } } } diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index a312a8b60218d..938e8f2057524 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -744,7 +744,7 @@ async def test_thermostat_raise_repair_issue_when_setting_dry_preset( blocking=True, ) - issue_id = f"dry_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + issue_id = f"dry_fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" issue_registry = ir.async_get(hass) assert issue_registry.async_get_issue( domain=DOMAIN, @@ -773,7 +773,7 @@ async def test_thermostat_raise_repair_issue_when_setting_fan_preset( blocking=True, ) - issue_id = f"fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + issue_id = f"dry_fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" issue_registry = ir.async_get(hass) assert issue_registry.async_get_issue( domain=DOMAIN, From 14dfb7a888b3338c2289306f8c8bbfe89e37d983 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 13:59:17 +0000 Subject: [PATCH 03/16] Remove THERMOSTAT_MODE_SETPOINT_MAP (revert change) Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 23 +------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index ed44ecb1f6718..965028e5e746a 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -9,6 +9,7 @@ THERMOSTAT_CURRENT_TEMP_PROPERTY, THERMOSTAT_HUMIDITY_PROPERTY, THERMOSTAT_MODE_PROPERTY, + THERMOSTAT_MODE_SETPOINT_MAP, THERMOSTAT_OPERATING_STATE_PROPERTY, THERMOSTAT_SETPOINT_PROPERTY, ThermostatMode, @@ -57,28 +58,6 @@ ThermostatMode.DRY, ] -THERMOSTAT_MODE_SETPOINT_MAP: dict[int, list[ThermostatSetpointType]] = { - ThermostatMode.OFF: [], - ThermostatMode.HEAT: [ThermostatSetpointType.HEATING], - ThermostatMode.COOL: [ThermostatSetpointType.COOLING], - ThermostatMode.AUTO: [ - ThermostatSetpointType.HEATING, - ThermostatSetpointType.COOLING, - ], - ThermostatMode.AUXILIARY: [ThermostatSetpointType.HEATING], - ThermostatMode.FURNACE: [ThermostatSetpointType.FURNACE], - ThermostatMode.DRY: [ThermostatSetpointType.DRY_AIR], - ThermostatMode.MOIST: [ThermostatSetpointType.MOIST_AIR], - ThermostatMode.AUTO_CHANGE_OVER: [ThermostatSetpointType.AUTO_CHANGEOVER], - ThermostatMode.HEATING_ECON: [ThermostatSetpointType.ENERGY_SAVE_HEATING], - ThermostatMode.COOLING_ECON: [ThermostatSetpointType.ENERGY_SAVE_COOLING], - ThermostatMode.AWAY: [ - ThermostatSetpointType.AWAY_HEATING, - ThermostatSetpointType.AWAY_COOLING, - ], - ThermostatMode.FULL_POWER: [ThermostatSetpointType.FULL_POWER], -} - # Map Z-Wave HVAC Mode to Home Assistant value # Note: We treat "auto" as "heat_cool" as most Z-Wave devices # report auto_changeover as auto without schedule support. From 364a459dfba605024f425a438d042bf38245c24b Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 14:15:06 +0000 Subject: [PATCH 04/16] Update repair text Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index 580aa6ecc41a6..dcee91d93f947 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -153,7 +153,7 @@ }, "dry_fan_presets_deprecation": { "title": "Dry and Fan preset modes will be removed: {entity_id}", - "description": "You are getting this issue because 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 in a future version of Home Assistant. To fix this issue, please update your automations to use the corresponding Dry and Fan **HVAC modes** instead." + "description": "You are getting this issue because 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 in a future version of Home Assistant. Please update your automations to use the corresponding Dry and Fan **HVAC modes** instead. You can then manually repair this issue to resolve it." } } } From bc9383d405eec4bec60deb111a29a579601f9f33 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 15:27:27 +0000 Subject: [PATCH 05/16] Make repair issue fixable Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 2 +- homeassistant/components/zwave_js/strings.json | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 965028e5e746a..33995ec1e3e8e 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -510,7 +510,7 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: self.hass, DOMAIN, f"dry_fan_preset_deprecation_{self.entity_id}", - is_fixable=False, + is_fixable=True, is_persistent=True, severity=IssueSeverity.WARNING, translation_key="dry_fan_presets_deprecation", diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index dcee91d93f947..dd9ff731e67e8 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -153,7 +153,14 @@ }, "dry_fan_presets_deprecation": { "title": "Dry and Fan preset modes will be removed: {entity_id}", - "description": "You are getting this issue because 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 in a future version of Home Assistant. Please update your automations to use the corresponding Dry and Fan **HVAC modes** instead. You can then manually repair this issue to resolve it." + "fix_flow": { + "step": { + "confirm": { + "title": "Dry and Fan preset modes will be removed: {entity_id}", + "description": "You are getting this issue because 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 in a future version of Home Assistant. 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." + } + } + } } } } From e7d6ea53e2527bfde690583737d3de0eb6e3ab28 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Thu, 6 Jul 2023 15:33:46 +0000 Subject: [PATCH 06/16] Fix plural Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 33995ec1e3e8e..9ae1eb5581af4 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -509,7 +509,7 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: async_create_issue( self.hass, DOMAIN, - f"dry_fan_preset_deprecation_{self.entity_id}", + f"dry_fan_presets_deprecation_{self.entity_id}", is_fixable=True, is_persistent=True, severity=IssueSeverity.WARNING, From f60420b5b299cd57c99ea32f815f42f84bbff11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Moreno?= Date: Fri, 7 Jul 2023 09:36:28 +0200 Subject: [PATCH 07/16] Update tests/components/zwave_js/test_climate.py Co-authored-by: Martin Hjelmare --- tests/components/zwave_js/test_climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index 938e8f2057524..0237fca88bc5a 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -744,7 +744,7 @@ async def test_thermostat_raise_repair_issue_when_setting_dry_preset( blocking=True, ) - issue_id = f"dry_fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + 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, From a37a2ecbc41ea5808af14bd696885d9c09fc8dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Moreno?= Date: Fri, 7 Jul 2023 09:36:34 +0200 Subject: [PATCH 08/16] Update tests/components/zwave_js/test_climate.py Co-authored-by: Martin Hjelmare --- tests/components/zwave_js/test_climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index 0237fca88bc5a..e8f8af5a6a1a0 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -773,7 +773,7 @@ async def test_thermostat_raise_repair_issue_when_setting_fan_preset( blocking=True, ) - issue_id = f"dry_fan_preset_deprecation_{CLIMATE_AIDOO_HVAC_UNIT_ENTITY}" + 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, From 7da0baf8d5a6a3bcc805a9bed72d4a2ca07435ff Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 7 Jul 2023 07:50:32 +0000 Subject: [PATCH 09/16] Add warning log back again Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 6 +++++- tests/components/zwave_js/test_climate.py | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 9ae1eb5581af4..0f487d7cbde23 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -40,7 +40,7 @@ from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.util.unit_conversion import TemperatureConverter -from .const import DATA_CLIENT, DOMAIN +from .const import DATA_CLIENT, DOMAIN, LOGGER from .discovery import ZwaveDiscoveryInfo from .discovery_data_template import DynamicCurrentTempClimateDataTemplate from .entity import ZWaveBaseEntity @@ -506,6 +506,10 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: # Dry and Fan preset modes are deprecated as of 2023.8 # 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 a future release. " + "Use the corresponding Dry and Fan HVAC modes instead" + ) async_create_issue( self.hass, DOMAIN, diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index e8f8af5a6a1a0..77862f112b45e 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -723,7 +723,7 @@ async def test_thermostat_dry_and_fan_both_hvac_mode_and_preset( ] -async def test_thermostat_raise_repair_issue_when_setting_dry_preset( +async def test_thermostat_raise_repair_issue_and_warning_when_setting_dry_preset( hass: HomeAssistant, client, climate_airzone_aidoo_control_hvac_unit, @@ -746,20 +746,25 @@ async def test_thermostat_raise_repair_issue_when_setting_dry_preset( 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 a future release. Use the corresponding Dry and Fan HVAC modes instead" + in caplog.text + ) -async def test_thermostat_raise_repair_issue_when_setting_fan_preset( +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 when setting Fan preset.""" + """Test raise of repair issue and warning log when setting Fan preset.""" state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state @@ -775,7 +780,12 @@ async def test_thermostat_raise_repair_issue_when_setting_fan_preset( 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 a future release. Use the corresponding Dry and Fan HVAC modes instead" + in caplog.text + ) From edf5d66f2580030d3452cf303724018da8a87369 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 7 Jul 2023 07:54:54 +0000 Subject: [PATCH 10/16] revert unrelated change Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 0f487d7cbde23..bebeaccb9f605 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -9,7 +9,6 @@ THERMOSTAT_CURRENT_TEMP_PROPERTY, THERMOSTAT_HUMIDITY_PROPERTY, THERMOSTAT_MODE_PROPERTY, - THERMOSTAT_MODE_SETPOINT_MAP, THERMOSTAT_OPERATING_STATE_PROPERTY, THERMOSTAT_SETPOINT_PROPERTY, ThermostatMode, @@ -58,6 +57,28 @@ ThermostatMode.DRY, ] +THERMOSTAT_MODE_SETPOINT_MAP: dict[int, list[ThermostatSetpointType]] = { + ThermostatMode.OFF: [], + ThermostatMode.HEAT: [ThermostatSetpointType.HEATING], + ThermostatMode.COOL: [ThermostatSetpointType.COOLING], + ThermostatMode.AUTO: [ + ThermostatSetpointType.HEATING, + ThermostatSetpointType.COOLING, + ], + ThermostatMode.AUXILIARY: [ThermostatSetpointType.HEATING], + ThermostatMode.FURNACE: [ThermostatSetpointType.FURNACE], + ThermostatMode.DRY: [ThermostatSetpointType.DRY_AIR], + ThermostatMode.MOIST: [ThermostatSetpointType.MOIST_AIR], + ThermostatMode.AUTO_CHANGE_OVER: [ThermostatSetpointType.AUTO_CHANGEOVER], + ThermostatMode.HEATING_ECON: [ThermostatSetpointType.ENERGY_SAVE_HEATING], + ThermostatMode.COOLING_ECON: [ThermostatSetpointType.ENERGY_SAVE_COOLING], + ThermostatMode.AWAY: [ + ThermostatSetpointType.AWAY_HEATING, + ThermostatSetpointType.AWAY_COOLING, + ], + ThermostatMode.FULL_POWER: [ThermostatSetpointType.FULL_POWER], +} + # Map Z-Wave HVAC Mode to Home Assistant value # Note: We treat "auto" as "heat_cool" as most Z-Wave devices # report auto_changeover as auto without schedule support. From 1b8391340b1fe8828c0717e6bf940f2263a3a7e7 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 7 Jul 2023 08:04:59 +0000 Subject: [PATCH 11/16] update test case comment Signed-off-by: Adrian Moreno --- tests/components/zwave_js/test_climate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index 77862f112b45e..35e08206574d3 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -730,7 +730,7 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_dry_preset integration, caplog: pytest.LogCaptureFixture, ) -> None: - """Test raise of repair issue when setting Dry preset.""" + """Test raise of repair issue and warning when setting Dry preset.""" state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state @@ -764,7 +764,7 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_fan_preset integration, caplog: pytest.LogCaptureFixture, ) -> None: - """Test raise of repair issue and warning log when setting Fan preset.""" + """Test raise of repair issue and warning when setting Fan preset.""" state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state From 317d3d4c59de4dfeb1bb4084fd93bd22ebc2e35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Moreno?= Date: Fri, 7 Jul 2023 10:33:03 +0200 Subject: [PATCH 12/16] Update homeassistant/components/zwave_js/strings.json Co-authored-by: Martin Hjelmare --- homeassistant/components/zwave_js/strings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index dd9ff731e67e8..b0e5e27af3593 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -157,7 +157,7 @@ "step": { "confirm": { "title": "Dry and Fan preset modes will be removed: {entity_id}", - "description": "You are getting this issue because 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 in a future version of Home Assistant. 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." + "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 in a future version of Home Assistant. 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." } } } From 541e19e9b334d0fe483a14830c01e1b4bb40e5f5 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 7 Jul 2023 14:47:54 +0000 Subject: [PATCH 13/16] Add breaks_in_ha_version="2024.2.0" to repair issue Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 0f487d7cbde23..aad348b97a569 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -514,6 +514,7 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: 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, From 7d93271493f36cf4f9f01d0b6d6938c77cf078f0 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 7 Jul 2023 18:08:22 +0000 Subject: [PATCH 14/16] Show breaking change version in warning and repair issue Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 8 ++++---- homeassistant/components/zwave_js/strings.json | 2 +- tests/components/zwave_js/test_climate.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index aad348b97a569..327db05cb00a5 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -503,12 +503,12 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: preset_mode_value = self._hvac_presets.get(preset_mode) if preset_mode_value is None: raise ValueError(f"Received an invalid preset mode: {preset_mode}") - # Dry and Fan preset modes are deprecated as of 2023.8 - # Use Dry and Fan HVAC modes instead + # 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 a future release. " - "Use the corresponding Dry and Fan HVAC modes instead" + "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, diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index b0e5e27af3593..1d2fc7013df32 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -157,7 +157,7 @@ "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 in a future version of Home Assistant. 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." + "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 in Home Assistant 2024.2. 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." } } } diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index 35e08206574d3..23d34c131b869 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -752,7 +752,7 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_dry_preset issue_id=issue_id, ) assert ( - "Dry and Fan preset modes are deprecated and will be removed in a future release. Use the corresponding Dry and Fan HVAC modes instead" + "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 ) @@ -786,6 +786,6 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_fan_preset issue_id=issue_id, ) assert ( - "Dry and Fan preset modes are deprecated and will be removed in a future release. Use the corresponding Dry and Fan HVAC modes instead" + "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 ) From d5a69db69bbb72d512797a665ebe6898cd1ac346 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Mon, 10 Jul 2023 15:37:29 +0000 Subject: [PATCH 15/16] remove hardcoded HA version from strings.json Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 4 +++- homeassistant/components/zwave_js/strings.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 327db05cb00a5..cd1a39d5ae121 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -510,17 +510,19 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: "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" ) + breaks_in_ha_version = "2024.2.0" async_create_issue( self.hass, DOMAIN, f"dry_fan_presets_deprecation_{self.entity_id}", - breaks_in_ha_version="2024.2.0", + breaks_in_ha_version=breaks_in_ha_version, is_fixable=True, is_persistent=True, severity=IssueSeverity.WARNING, translation_key="dry_fan_presets_deprecation", translation_placeholders={ "entity_id": self.entity_id, + "breaks_in_ha_version": breaks_in_ha_version, }, ) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index 1d2fc7013df32..ef13ae97ea893 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -157,7 +157,7 @@ "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 in Home Assistant 2024.2. 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." + "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 in Home Assistant {breaks_in_ha_version}. 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." } } } From 655dd62210176a8b68b979da9f8f88dfa01f3ad1 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Wed, 12 Jul 2023 08:14:46 +0000 Subject: [PATCH 16/16] remove breaking change version from repair issue text Signed-off-by: Adrian Moreno --- homeassistant/components/zwave_js/climate.py | 4 +--- homeassistant/components/zwave_js/strings.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index cd1a39d5ae121..327db05cb00a5 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -510,19 +510,17 @@ async def async_set_preset_mode(self, preset_mode: str) -> None: "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" ) - breaks_in_ha_version = "2024.2.0" async_create_issue( self.hass, DOMAIN, f"dry_fan_presets_deprecation_{self.entity_id}", - breaks_in_ha_version=breaks_in_ha_version, + 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, - "breaks_in_ha_version": breaks_in_ha_version, }, ) diff --git a/homeassistant/components/zwave_js/strings.json b/homeassistant/components/zwave_js/strings.json index ef13ae97ea893..3939e7df98570 100644 --- a/homeassistant/components/zwave_js/strings.json +++ b/homeassistant/components/zwave_js/strings.json @@ -157,7 +157,7 @@ "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 in Home Assistant {breaks_in_ha_version}. 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." + "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." } } }