From 51ccba12af2ba1f435383149474af50429337463 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Thu, 2 Jan 2025 10:45:20 +0100 Subject: [PATCH] Add action translations to Sensibo (#134420) --- homeassistant/components/sensibo/climate.py | 9 +++-- .../components/sensibo/services.yaml | 11 ++++-- homeassistant/components/sensibo/strings.json | 38 +++++++++++++++++++ tests/components/sensibo/test_climate.py | 4 +- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/sensibo/climate.py b/homeassistant/components/sensibo/climate.py index c66ca47e463..db1f2f83691 100644 --- a/homeassistant/components/sensibo/climate.py +++ b/homeassistant/components/sensibo/climate.py @@ -154,7 +154,7 @@ async def async_setup_entry( vol.Required(ATTR_GEO_INTEGRATION): bool, vol.Required(ATTR_INDOOR_INTEGRATION): bool, vol.Required(ATTR_OUTDOOR_INTEGRATION): bool, - vol.Required(ATTR_SENSITIVITY): vol.In(["Normal", "Sensitive"]), + vol.Required(ATTR_SENSITIVITY): vol.In(["normal", "sensitive"]), }, "async_enable_pure_boost", ) @@ -168,7 +168,7 @@ async def async_setup_entry( vol.Optional(ATTR_FAN_MODE): str, vol.Optional(ATTR_SWING_MODE): str, vol.Optional(ATTR_HORIZONTAL_SWING_MODE): str, - vol.Optional(ATTR_LIGHT): vol.In(["on", "off"]), + vol.Optional(ATTR_LIGHT): vol.In(["on", "off", "dim"]), }, "async_full_ac_state", ) @@ -473,7 +473,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): "enabled": True, } if sensitivity is not None: - params["sensitivity"] = sensitivity[0] + params["sensitivity"] = sensitivity[0].upper() if indoor_integration is not None: params["measurementsIntegration"] = indoor_integration if ac_integration is not None: @@ -513,6 +513,9 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): UnitOfTemperature.CELSIUS, ) + if smart_type == "feelslike": + smart_type = "feelsLike" + params: dict[str, str | bool | float | dict] = { "enabled": True, "deviceUid": self._device_id, diff --git a/homeassistant/components/sensibo/services.yaml b/homeassistant/components/sensibo/services.yaml index 7f8252af820..7d2a644edfd 100644 --- a/homeassistant/components/sensibo/services.yaml +++ b/homeassistant/components/sensibo/services.yaml @@ -12,6 +12,7 @@ assume_state: options: - "on" - "off" + translation_key: assume_state enable_timer: target: entity: @@ -58,8 +59,9 @@ enable_pure_boost: selector: select: options: - - "Normal" - - "Sensitive" + - "normal" + - "sensitive" + translation_key: sensitivity full_state: target: entity: @@ -78,6 +80,7 @@ full_state: - "auto" - "dry" - "off" + translation_key: hvac_mode target_temperature: required: false example: 23 @@ -113,6 +116,7 @@ full_state: - "on" - "off" - "dim" + translation_key: light_mode enable_climate_react: target: entity: @@ -152,5 +156,6 @@ enable_climate_react: select: options: - "temperature" - - "feelsLike" + - "feelslike" - "humidity" + translation_key: smart_type diff --git a/homeassistant/components/sensibo/strings.json b/homeassistant/components/sensibo/strings.json index 9e049a6a4dd..fc8afd74972 100644 --- a/homeassistant/components/sensibo/strings.json +++ b/homeassistant/components/sensibo/strings.json @@ -496,6 +496,44 @@ } } }, + "selector": { + "sensitivity": { + "options": { + "normal": "[%key:component::sensibo::entity::sensor::sensitivity::state::n%]", + "sensitive": "[%key:component::sensibo::entity::sensor::sensitivity::state::s%]" + } + }, + "assume_state": { + "options": { + "on": "[%key:common::state::on%]", + "off": "[%key:common::state::off%]" + } + }, + "hvac_mode": { + "options": { + "cool": "[%key:component::climate::entity_component::_::state::cool%]", + "heat": "[%key:component::climate::entity_component::_::state::heat%]", + "fan": "[%key:component::climate::entity_component::_::state::fan_only%]", + "auto": "[%key:component::climate::entity_component::_::state::auto%]", + "dry": "[%key:component::climate::entity_component::_::state::dry%]", + "off": "[%key:common::state::off%]" + } + }, + "light_mode": { + "options": { + "on": "[%key:common::state::on%]", + "off": "[%key:common::state::off%]", + "dim": "[%key:component::sensibo::entity::select::light::state::dim%]" + } + }, + "smart_type": { + "options": { + "temperature": "[%key:component::sensor::entity_component::temperature::name%]", + "feelslike": "[%key:component::sensibo::entity::switch::climate_react_switch::state_attributes::type::state::feelslike%]", + "humidity": "[%key:component::sensor::entity_component::humidity::name%]" + } + } + }, "exceptions": { "no_target_temperature_in_features": { "message": "Current mode doesn't support setting target temperature" diff --git a/tests/components/sensibo/test_climate.py b/tests/components/sensibo/test_climate.py index 7916727e57a..dbc420812ae 100644 --- a/tests/components/sensibo/test_climate.py +++ b/tests/components/sensibo/test_climate.py @@ -1001,7 +1001,7 @@ async def test_climate_pure_boost( ATTR_ENTITY_ID: state_climate.entity_id, ATTR_INDOOR_INTEGRATION: True, ATTR_OUTDOOR_INTEGRATION: True, - ATTR_SENSITIVITY: "Sensitive", + ATTR_SENSITIVITY: "sensitive", }, blocking=True, ) @@ -1036,7 +1036,7 @@ async def test_climate_pure_boost( ATTR_GEO_INTEGRATION: False, ATTR_INDOOR_INTEGRATION: True, ATTR_OUTDOOR_INTEGRATION: True, - ATTR_SENSITIVITY: "Sensitive", + ATTR_SENSITIVITY: "sensitive", }, blocking=True, )