From 02ff9d6667a4656ebf67eb7ffb7a3b6d304aeff2 Mon Sep 17 00:00:00 2001 From: treetip Date: Sun, 23 Jun 2024 07:48:24 +0000 Subject: [PATCH 1/7] Add set_profile service for Vallox integration --- homeassistant/components/vallox/__init__.py | 28 +++++++++++++++++++ homeassistant/components/vallox/icons.json | 3 +- homeassistant/components/vallox/services.yaml | 25 +++++++++++++++++ homeassistant/components/vallox/strings.json | 14 ++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/vallox/__init__.py b/homeassistant/components/vallox/__init__.py index 292786e4c0e9b5..11c3c234d20d2e 100644 --- a/homeassistant/components/vallox/__init__.py +++ b/homeassistant/components/vallox/__init__.py @@ -72,6 +72,7 @@ class ServiceMethodDetails(NamedTuple): SERVICE_SET_PROFILE_FAN_SPEED_HOME = "set_profile_fan_speed_home" SERVICE_SET_PROFILE_FAN_SPEED_AWAY = "set_profile_fan_speed_away" SERVICE_SET_PROFILE_FAN_SPEED_BOOST = "set_profile_fan_speed_boost" +SERVICE_SET_PROFILE = "set_profile" SERVICE_TO_METHOD = { SERVICE_SET_PROFILE_FAN_SPEED_HOME: ServiceMethodDetails( @@ -86,6 +87,19 @@ class ServiceMethodDetails(NamedTuple): method="async_set_profile_fan_speed_boost", schema=SERVICE_SCHEMA_SET_PROFILE_FAN_SPEED, ), + SERVICE_SET_PROFILE: ServiceMethodDetails( + method="async_set_profile", + schema=vol.Schema( + { + vol.Required("profile"): vol.All( + vol.Coerce(int), vol.Clamp(min=1, max=5) + ), + vol.Optional("duration"): vol.All( + vol.Coerce(int), vol.Clamp(min=1, max=65535) + ), + } + ), + ), } @@ -183,6 +197,20 @@ async def async_set_profile_fan_speed_boost( return False return True + async def async_set_profile( + self, profile: int, duration: int | None = None + ) -> bool: + """Activate profile for given duration.""" + _LOGGER.debug("Activating profile %s for %d min", profile, duration) + try: + await self._client.set_profile(Profile(profile), duration) + except ValloxApiException as err: + _LOGGER.error( + "Error setting profile %d for duration %d: %s", profile, duration, err + ) + return False + return True + async def async_handle(self, call: ServiceCall) -> None: """Dispatch a service call.""" service_details = SERVICE_TO_METHOD.get(call.service) diff --git a/homeassistant/components/vallox/icons.json b/homeassistant/components/vallox/icons.json index f6beb55f1daa9a..3d037687b2524f 100644 --- a/homeassistant/components/vallox/icons.json +++ b/homeassistant/components/vallox/icons.json @@ -45,6 +45,7 @@ }, "set_profile_fan_speed_boost": { "service": "mdi:speedometer" - } + }, + "set_profile": "mdi:fan" } } diff --git a/homeassistant/components/vallox/services.yaml b/homeassistant/components/vallox/services.yaml index e6bd3edad116ca..a7c4c910530625 100644 --- a/homeassistant/components/vallox/services.yaml +++ b/homeassistant/components/vallox/services.yaml @@ -27,3 +27,28 @@ set_profile_fan_speed_boost: min: 0 max: 100 unit_of_measurement: "%" + +set_profile: + fields: + profile: + required: true + selector: + select: + options: + - label: "Home" + value: "1" + - label: "Away" + value: "2" + - label: "Boost" + value: "3" + - label: "Fireplace" + value: "4" + - label: "Extra" + value: "5" + duration: + required: false + selector: + number: + min: 1 + max: 65535 + unit_of_measurement: "min" diff --git a/homeassistant/components/vallox/strings.json b/homeassistant/components/vallox/strings.json index 4df57b81bb5edc..5dbec4773e13db 100644 --- a/homeassistant/components/vallox/strings.json +++ b/homeassistant/components/vallox/strings.json @@ -133,6 +133,20 @@ "description": "[%key:component::vallox::services::set_profile_fan_speed_home::fields::fan_speed::description%]" } } + }, + "set_profile": { + "name": "Activate profile for duration", + "description": "Activate a profile and optionally set duration.", + "fields": { + "profile": { + "name": "Profile", + "description": "Profile to activate" + }, + "duration": { + "name": "Duration", + "description": "Activation duration, if omitted device uses stored duration. Duration of 65535 activates profile without timeout. Duration only applies to Boost, Fireplace and Extra profiles." + } + } } } } From 3cee7bd8bf28856a8d3261bc5edfe610dc754ab4 Mon Sep 17 00:00:00 2001 From: treetip Date: Mon, 24 Jun 2024 06:50:29 +0000 Subject: [PATCH 2/7] Merge profile constants, use str input for service --- homeassistant/components/vallox/__init__.py | 11 ++++++----- homeassistant/components/vallox/const.py | 13 +++---------- homeassistant/components/vallox/fan.py | 12 ++++++------ homeassistant/components/vallox/sensor.py | 4 ++-- homeassistant/components/vallox/services.yaml | 15 +++++---------- 5 files changed, 22 insertions(+), 33 deletions(-) diff --git a/homeassistant/components/vallox/__init__.py b/homeassistant/components/vallox/__init__.py index 11c3c234d20d2e..8b24dfefac4713 100644 --- a/homeassistant/components/vallox/__init__.py +++ b/homeassistant/components/vallox/__init__.py @@ -22,6 +22,7 @@ DEFAULT_FAN_SPEED_HOME, DEFAULT_NAME, DOMAIN, + PRESET_MODE_TO_VALLOX_PROFILE, ) from .coordinator import ValloxDataUpdateCoordinator @@ -91,9 +92,7 @@ class ServiceMethodDetails(NamedTuple): method="async_set_profile", schema=vol.Schema( { - vol.Required("profile"): vol.All( - vol.Coerce(int), vol.Clamp(min=1, max=5) - ), + vol.Required("profile"): vol.In(PRESET_MODE_TO_VALLOX_PROFILE), vol.Optional("duration"): vol.All( vol.Coerce(int), vol.Clamp(min=1, max=65535) ), @@ -198,12 +197,14 @@ async def async_set_profile_fan_speed_boost( return True async def async_set_profile( - self, profile: int, duration: int | None = None + self, profile: str, duration: int | None = None ) -> bool: """Activate profile for given duration.""" _LOGGER.debug("Activating profile %s for %d min", profile, duration) try: - await self._client.set_profile(Profile(profile), duration) + await self._client.set_profile( + PRESET_MODE_TO_VALLOX_PROFILE[profile], duration + ) except ValloxApiException as err: _LOGGER.error( "Error setting profile %d for duration %d: %s", profile, duration, err diff --git a/homeassistant/components/vallox/const.py b/homeassistant/components/vallox/const.py index a2494c594f5887..97f6ca4189a8ba 100644 --- a/homeassistant/components/vallox/const.py +++ b/homeassistant/components/vallox/const.py @@ -22,14 +22,7 @@ DEFAULT_FAN_SPEED_AWAY = 25 DEFAULT_FAN_SPEED_BOOST = 65 -VALLOX_PROFILE_TO_PRESET_MODE_SETTABLE = { - VALLOX_PROFILE.HOME: "Home", - VALLOX_PROFILE.AWAY: "Away", - VALLOX_PROFILE.BOOST: "Boost", - VALLOX_PROFILE.FIREPLACE: "Fireplace", -} - -VALLOX_PROFILE_TO_PRESET_MODE_REPORTABLE = { +VALLOX_PROFILE_TO_PRESET_MODE = { VALLOX_PROFILE.HOME: "Home", VALLOX_PROFILE.AWAY: "Away", VALLOX_PROFILE.BOOST: "Boost", @@ -37,8 +30,8 @@ VALLOX_PROFILE.EXTRA: "Extra", } -PRESET_MODE_TO_VALLOX_PROFILE_SETTABLE = { - value: key for (key, value) in VALLOX_PROFILE_TO_PRESET_MODE_SETTABLE.items() +PRESET_MODE_TO_VALLOX_PROFILE = { + value: key for (key, value) in VALLOX_PROFILE_TO_PRESET_MODE.items() } VALLOX_CELL_STATE_TO_STR = { diff --git a/homeassistant/components/vallox/fan.py b/homeassistant/components/vallox/fan.py index 4fe2cfd45d408a..c92261103325b8 100644 --- a/homeassistant/components/vallox/fan.py +++ b/homeassistant/components/vallox/fan.py @@ -23,8 +23,8 @@ METRIC_KEY_PROFILE_FAN_SPEED_HOME, MODE_OFF, MODE_ON, - PRESET_MODE_TO_VALLOX_PROFILE_SETTABLE, - VALLOX_PROFILE_TO_PRESET_MODE_REPORTABLE, + PRESET_MODE_TO_VALLOX_PROFILE, + VALLOX_PROFILE_TO_PRESET_MODE, ) from .coordinator import ValloxDataUpdateCoordinator @@ -97,7 +97,7 @@ def __init__( self._client = client self._attr_unique_id = str(self._device_uuid) - self._attr_preset_modes = list(PRESET_MODE_TO_VALLOX_PROFILE_SETTABLE) + self._attr_preset_modes = list(PRESET_MODE_TO_VALLOX_PROFILE) @property def is_on(self) -> bool: @@ -108,7 +108,7 @@ def is_on(self) -> bool: def preset_mode(self) -> str | None: """Return the current preset mode.""" vallox_profile = self.coordinator.data.profile - return VALLOX_PROFILE_TO_PRESET_MODE_REPORTABLE.get(vallox_profile) + return VALLOX_PROFILE_TO_PRESET_MODE.get(vallox_profile) @property def percentage(self) -> int | None: @@ -204,7 +204,7 @@ async def _async_set_preset_mode_internal(self, preset_mode: str) -> bool: return False try: - profile = PRESET_MODE_TO_VALLOX_PROFILE_SETTABLE[preset_mode] + profile = PRESET_MODE_TO_VALLOX_PROFILE[preset_mode] await self._client.set_profile(profile) except ValloxApiException as err: @@ -220,7 +220,7 @@ async def _async_set_percentage_internal( Returns true if speed has been changed, false otherwise. """ vallox_profile = ( - PRESET_MODE_TO_VALLOX_PROFILE_SETTABLE[preset_mode] + PRESET_MODE_TO_VALLOX_PROFILE[preset_mode] if preset_mode is not None else self.coordinator.data.profile ) diff --git a/homeassistant/components/vallox/sensor.py b/homeassistant/components/vallox/sensor.py index 0bb509a9c5a71e..fb9977cefaf16f 100644 --- a/homeassistant/components/vallox/sensor.py +++ b/homeassistant/components/vallox/sensor.py @@ -31,7 +31,7 @@ METRIC_KEY_MODE, MODE_ON, VALLOX_CELL_STATE_TO_STR, - VALLOX_PROFILE_TO_PRESET_MODE_REPORTABLE, + VALLOX_PROFILE_TO_PRESET_MODE, ) from .coordinator import ValloxDataUpdateCoordinator @@ -78,7 +78,7 @@ class ValloxProfileSensor(ValloxSensorEntity): def native_value(self) -> StateType: """Return the value reported by the sensor.""" vallox_profile = self.coordinator.data.profile - return VALLOX_PROFILE_TO_PRESET_MODE_REPORTABLE.get(vallox_profile) + return VALLOX_PROFILE_TO_PRESET_MODE.get(vallox_profile) # There is a quirk with respect to the fan speed reporting. The device keeps on reporting the last diff --git a/homeassistant/components/vallox/services.yaml b/homeassistant/components/vallox/services.yaml index a7c4c910530625..6ff0cf44cb566b 100644 --- a/homeassistant/components/vallox/services.yaml +++ b/homeassistant/components/vallox/services.yaml @@ -35,16 +35,11 @@ set_profile: selector: select: options: - - label: "Home" - value: "1" - - label: "Away" - value: "2" - - label: "Boost" - value: "3" - - label: "Fireplace" - value: "4" - - label: "Extra" - value: "5" + - "Home" + - "Away" + - "Boost" + - "Fireplace" + - "Extra" duration: required: false selector: From a5408ebbf593eb6dfe6afbfb22ceb39c3d42ba49 Mon Sep 17 00:00:00 2001 From: treetip Date: Tue, 25 Jun 2024 14:15:17 +0000 Subject: [PATCH 3/7] add service test and some related refactoring --- homeassistant/components/vallox/__init__.py | 26 ++++++----- tests/components/vallox/test_init.py | 49 ++++++++++++++++++++- 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/vallox/__init__.py b/homeassistant/components/vallox/__init__.py index 8b24dfefac4713..3a9ffb63810708 100644 --- a/homeassistant/components/vallox/__init__.py +++ b/homeassistant/components/vallox/__init__.py @@ -62,6 +62,18 @@ } ) +ATTR_PROFILE = "profile" +ATTR_DURATION = "duration" + +SERVICE_SCHEMA_SET_PROFILE = vol.Schema( + { + vol.Required(ATTR_PROFILE): vol.In(PRESET_MODE_TO_VALLOX_PROFILE), + vol.Optional(ATTR_DURATION): vol.All( + vol.Coerce(int), vol.Clamp(min=1, max=65535) + ), + } +) + class ServiceMethodDetails(NamedTuple): """Details for SERVICE_TO_METHOD mapping.""" @@ -89,15 +101,7 @@ class ServiceMethodDetails(NamedTuple): schema=SERVICE_SCHEMA_SET_PROFILE_FAN_SPEED, ), SERVICE_SET_PROFILE: ServiceMethodDetails( - method="async_set_profile", - schema=vol.Schema( - { - vol.Required("profile"): vol.In(PRESET_MODE_TO_VALLOX_PROFILE), - vol.Optional("duration"): vol.All( - vol.Coerce(int), vol.Clamp(min=1, max=65535) - ), - } - ), + method="async_set_profile", schema=SERVICE_SCHEMA_SET_PROFILE ), } @@ -200,14 +204,14 @@ async def async_set_profile( self, profile: str, duration: int | None = None ) -> bool: """Activate profile for given duration.""" - _LOGGER.debug("Activating profile %s for %d min", profile, duration) + _LOGGER.debug("Activating profile %s for %s min", profile, duration) try: await self._client.set_profile( PRESET_MODE_TO_VALLOX_PROFILE[profile], duration ) except ValloxApiException as err: _LOGGER.error( - "Error setting profile %d for duration %d: %s", profile, duration, err + "Error setting profile %d for duration %s: %s", profile, duration, err ) return False return True diff --git a/tests/components/vallox/test_init.py b/tests/components/vallox/test_init.py index 58e46acd689fdc..525e894d1c13c7 100644 --- a/tests/components/vallox/test_init.py +++ b/tests/components/vallox/test_init.py @@ -4,15 +4,18 @@ from vallox_websocket_api import Profile from homeassistant.components.vallox import ( + ATTR_DURATION, + ATTR_PROFILE, ATTR_PROFILE_FAN_SPEED, + SERVICE_SET_PROFILE, SERVICE_SET_PROFILE_FAN_SPEED_AWAY, SERVICE_SET_PROFILE_FAN_SPEED_BOOST, SERVICE_SET_PROFILE_FAN_SPEED_HOME, ) -from homeassistant.components.vallox.const import DOMAIN +from homeassistant.components.vallox.const import DOMAIN, PRESET_MODE_TO_VALLOX_PROFILE from homeassistant.core import HomeAssistant -from .conftest import patch_set_fan_speed +from .conftest import patch_set_fan_speed, patch_set_profile from tests.common import MockConfigEntry @@ -47,3 +50,45 @@ async def test_create_service( # Assert set_fan_speed.assert_called_once_with(profile, 30) + + +@pytest.mark.parametrize( + ("profile", "duration"), + [ + ("Home", None), + ("Home", 15), + ("Away", None), + ("Away", 15), + ("Boost", None), + ("Boost", 15), + ("Fireplace", None), + ("Fireplace", 15), + ("Extra", None), + ("Extra", 15), + ], +) +async def test_set_profile_service( + hass: HomeAssistant, mock_entry: MockConfigEntry, profile: str, duration: int | None +) -> None: + """Test service for setting profile and duration.""" + # Act + await hass.config_entries.async_setup(mock_entry.entry_id) + await hass.async_block_till_done() + + with patch_set_profile() as set_profile: + service_data = {ATTR_PROFILE: profile} | ( + {ATTR_DURATION: duration} if duration is not None else {} + ) + + await hass.services.async_call( + DOMAIN, + SERVICE_SET_PROFILE, + service_data=service_data, + ) + + await hass.async_block_till_done() + + # Assert + set_profile.assert_called_once_with( + PRESET_MODE_TO_VALLOX_PROFILE[profile], duration + ) From 6ea2d4c38d8920bfa231f1cfcd8eabef1e39f928 Mon Sep 17 00:00:00 2001 From: treetip Date: Thu, 27 Jun 2024 22:21:01 +0300 Subject: [PATCH 4/7] Change service uom to 'minutes' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Lövdahl --- homeassistant/components/vallox/services.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/vallox/services.yaml b/homeassistant/components/vallox/services.yaml index 6ff0cf44cb566b..d690e738627ecc 100644 --- a/homeassistant/components/vallox/services.yaml +++ b/homeassistant/components/vallox/services.yaml @@ -46,4 +46,4 @@ set_profile: number: min: 1 max: 65535 - unit_of_measurement: "min" + unit_of_measurement: "minutes" From a6b6ed744fd8b56e553cb79927e7f8f312f5666a Mon Sep 17 00:00:00 2001 From: treetip Date: Sat, 7 Sep 2024 10:46:19 +0300 Subject: [PATCH 5/7] Update icons.js format after rebase --- homeassistant/components/vallox/icons.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/vallox/icons.json b/homeassistant/components/vallox/icons.json index 3d037687b2524f..9123d1bfe9bd2d 100644 --- a/homeassistant/components/vallox/icons.json +++ b/homeassistant/components/vallox/icons.json @@ -46,6 +46,8 @@ "set_profile_fan_speed_boost": { "service": "mdi:speedometer" }, - "set_profile": "mdi:fan" + "set_profile": { + "service": "mdi:fan" + } } } From dc89364c17fb10f5544b0bd6b1fd050269882b45 Mon Sep 17 00:00:00 2001 From: treetip Date: Sat, 7 Sep 2024 14:09:13 +0300 Subject: [PATCH 6/7] Translate profile names for service --- homeassistant/components/vallox/__init__.py | 6 +++--- homeassistant/components/vallox/const.py | 8 ++++++++ homeassistant/components/vallox/services.yaml | 11 +++++----- homeassistant/components/vallox/strings.json | 11 ++++++++++ tests/components/vallox/test_init.py | 20 +++++++++---------- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/vallox/__init__.py b/homeassistant/components/vallox/__init__.py index 3a9ffb63810708..09080f1a5f621b 100644 --- a/homeassistant/components/vallox/__init__.py +++ b/homeassistant/components/vallox/__init__.py @@ -22,7 +22,7 @@ DEFAULT_FAN_SPEED_HOME, DEFAULT_NAME, DOMAIN, - PRESET_MODE_TO_VALLOX_PROFILE, + I18N_KEY_TO_VALLOX_PROFILE, ) from .coordinator import ValloxDataUpdateCoordinator @@ -67,7 +67,7 @@ SERVICE_SCHEMA_SET_PROFILE = vol.Schema( { - vol.Required(ATTR_PROFILE): vol.In(PRESET_MODE_TO_VALLOX_PROFILE), + vol.Required(ATTR_PROFILE): vol.In(I18N_KEY_TO_VALLOX_PROFILE), vol.Optional(ATTR_DURATION): vol.All( vol.Coerce(int), vol.Clamp(min=1, max=65535) ), @@ -207,7 +207,7 @@ async def async_set_profile( _LOGGER.debug("Activating profile %s for %s min", profile, duration) try: await self._client.set_profile( - PRESET_MODE_TO_VALLOX_PROFILE[profile], duration + I18N_KEY_TO_VALLOX_PROFILE[profile], duration ) except ValloxApiException as err: _LOGGER.error( diff --git a/homeassistant/components/vallox/const.py b/homeassistant/components/vallox/const.py index 97f6ca4189a8ba..418f57a22c8256 100644 --- a/homeassistant/components/vallox/const.py +++ b/homeassistant/components/vallox/const.py @@ -22,6 +22,14 @@ DEFAULT_FAN_SPEED_AWAY = 25 DEFAULT_FAN_SPEED_BOOST = 65 +I18N_KEY_TO_VALLOX_PROFILE = { + "home": VALLOX_PROFILE.HOME, + "away": VALLOX_PROFILE.AWAY, + "boost": VALLOX_PROFILE.BOOST, + "fireplace": VALLOX_PROFILE.FIREPLACE, + "extra": VALLOX_PROFILE.EXTRA, +} + VALLOX_PROFILE_TO_PRESET_MODE = { VALLOX_PROFILE.HOME: "Home", VALLOX_PROFILE.AWAY: "Away", diff --git a/homeassistant/components/vallox/services.yaml b/homeassistant/components/vallox/services.yaml index d690e738627ecc..f2a55032b93147 100644 --- a/homeassistant/components/vallox/services.yaml +++ b/homeassistant/components/vallox/services.yaml @@ -34,12 +34,13 @@ set_profile: required: true selector: select: + translation_key: "profile" options: - - "Home" - - "Away" - - "Boost" - - "Fireplace" - - "Extra" + - "home" + - "away" + - "boost" + - "fireplace" + - "extra" duration: required: false selector: diff --git a/homeassistant/components/vallox/strings.json b/homeassistant/components/vallox/strings.json index 5dbec4773e13db..8a30ed4ad011ad 100644 --- a/homeassistant/components/vallox/strings.json +++ b/homeassistant/components/vallox/strings.json @@ -148,5 +148,16 @@ } } } + }, + "selector": { + "profile": { + "options": { + "home": "Home", + "away": "Away", + "boost": "Boost", + "fireplace": "Fireplace", + "extra": "Extra" + } + } } } diff --git a/tests/components/vallox/test_init.py b/tests/components/vallox/test_init.py index 525e894d1c13c7..ecff2ee7af9254 100644 --- a/tests/components/vallox/test_init.py +++ b/tests/components/vallox/test_init.py @@ -55,16 +55,16 @@ async def test_create_service( @pytest.mark.parametrize( ("profile", "duration"), [ - ("Home", None), - ("Home", 15), - ("Away", None), - ("Away", 15), - ("Boost", None), - ("Boost", 15), - ("Fireplace", None), - ("Fireplace", 15), - ("Extra", None), - ("Extra", 15), + ("home", None), + ("home", 15), + ("away", None), + ("away", 15), + ("boost", None), + ("boost", 15), + ("fireplace", None), + ("fireplace", 15), + ("extra", None), + ("extra", 15), ], ) async def test_set_profile_service( From aa178fc1f70d961747b1f25c46a01cb77947782a Mon Sep 17 00:00:00 2001 From: treetip Date: Sun, 8 Sep 2024 15:48:49 +0300 Subject: [PATCH 7/7] Fix test using wrong dict --- tests/components/vallox/test_init.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/components/vallox/test_init.py b/tests/components/vallox/test_init.py index ecff2ee7af9254..4fbde7e0357a54 100644 --- a/tests/components/vallox/test_init.py +++ b/tests/components/vallox/test_init.py @@ -7,12 +7,13 @@ ATTR_DURATION, ATTR_PROFILE, ATTR_PROFILE_FAN_SPEED, + I18N_KEY_TO_VALLOX_PROFILE, SERVICE_SET_PROFILE, SERVICE_SET_PROFILE_FAN_SPEED_AWAY, SERVICE_SET_PROFILE_FAN_SPEED_BOOST, SERVICE_SET_PROFILE_FAN_SPEED_HOME, ) -from homeassistant.components.vallox.const import DOMAIN, PRESET_MODE_TO_VALLOX_PROFILE +from homeassistant.components.vallox.const import DOMAIN from homeassistant.core import HomeAssistant from .conftest import patch_set_fan_speed, patch_set_profile @@ -90,5 +91,5 @@ async def test_set_profile_service( # Assert set_profile.assert_called_once_with( - PRESET_MODE_TO_VALLOX_PROFILE[profile], duration + I18N_KEY_TO_VALLOX_PROFILE[profile], duration )