Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
56b3471
Create repair issue instead of warning log
adrianmo Jul 6, 2023
14f5161
Use the same issue id for both dry and fan presets
adrianmo Jul 6, 2023
14dfb7a
Remove THERMOSTAT_MODE_SETPOINT_MAP (revert change)
adrianmo Jul 6, 2023
364a459
Update repair text
adrianmo Jul 6, 2023
1cf51f7
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 6, 2023
bc9383d
Make repair issue fixable
adrianmo Jul 6, 2023
e7d6ea5
Fix plural
adrianmo Jul 6, 2023
f60420b
Update tests/components/zwave_js/test_climate.py
adrianmo Jul 7, 2023
a37a2ec
Update tests/components/zwave_js/test_climate.py
adrianmo Jul 7, 2023
7da0baf
Add warning log back again
adrianmo Jul 7, 2023
edf5d66
revert unrelated change
adrianmo Jul 7, 2023
1b83913
update test case comment
adrianmo Jul 7, 2023
195a7f8
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 7, 2023
317d3d4
Update homeassistant/components/zwave_js/strings.json
adrianmo Jul 7, 2023
d1334ac
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 7, 2023
541e19e
Add breaks_in_ha_version="2024.2.0" to repair issue
adrianmo Jul 7, 2023
c8d1693
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 7, 2023
7d93271
Show breaking change version in warning and repair issue
adrianmo Jul 7, 2023
84593c9
Merge branch 'zwavejs_dry_fan_preset_repair' of github.com:adrianmo/h…
adrianmo Jul 7, 2023
03b625a
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 7, 2023
d5a69db
remove hardcoded HA version from strings.json
adrianmo Jul 10, 2023
c6826a8
Merge branch 'zwavejs_dry_fan_preset_repair' of github.com:adrianmo/h…
adrianmo Jul 10, 2023
8daf391
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 11, 2023
655dd62
remove breaking change version from repair issue text
adrianmo Jul 12, 2023
7d579c7
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 12, 2023
88e5ed7
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 14, 2023
c275ff2
Merge branch 'dev' into zwavejs_dry_fan_preset_repair
adrianmo Jul 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions homeassistant/components/zwave_js/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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
Expand Down Expand Up @@ -502,13 +503,29 @@ 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"
)
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,
is_fixable=True,
is_persistent=True,
Comment thread
adrianmo marked this conversation as resolved.
severity=IssueSeverity.WARNING,
translation_key="dry_fan_presets_deprecation",
translation_placeholders={
"entity_id": self.entity_id,
"breaks_in_ha_version": breaks_in_ha_version,
Comment thread
adrianmo marked this conversation as resolved.
Outdated
},
)

await self._async_set_value(self._current_mode, preset_mode_value)


Expand Down
11 changes: 11 additions & 0 deletions homeassistant/components/zwave_js/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@
"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": "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 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."
}
}
}
}
}
}
27 changes: 21 additions & 6 deletions tests/components/zwave_js/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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_and_warning_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 and warning when setting Dry preset."""
state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY)
assert state

Expand All @@ -743,20 +744,27 @@ async def test_thermostat_warning_when_setting_dry_preset(
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 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
)


async def test_thermostat_warning_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 warning 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

Expand All @@ -770,7 +778,14 @@ async def test_thermostat_warning_when_setting_fan_preset(
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 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
)