Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 17 additions & 3 deletions homeassistant/components/lg_thinq/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
FAN_MEDIUM,
PRESET_NONE,
SWING_OFF,
SWING_ON,
Expand Down Expand Up @@ -64,6 +65,12 @@

SWING_TO_STR = {v: k for k, v in STR_TO_SWING.items()}

STR_TO_HA_FAN: dict[str, str] = {
"mid": FAN_MEDIUM,
}

HA_FAN_TO_STR = {v: k for k, v in STR_TO_HA_FAN.items()}

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -124,7 +131,9 @@ def __init__(
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE

# Set up fan modes.
self._attr_fan_modes = self.data.fan_modes
self._attr_fan_modes = [
STR_TO_HA_FAN.get(fan, fan) for fan in self.data.fan_modes
]
if self.fan_modes:
self._attr_supported_features |= ClimateEntityFeature.FAN_MODE

Expand All @@ -148,7 +157,9 @@ def _update_status(self) -> None:

# Update fan, hvac and preset mode.
if self.supported_features & ClimateEntityFeature.FAN_MODE:
self._attr_fan_mode = self.data.fan_mode
self._attr_fan_mode = STR_TO_HA_FAN.get(
self.data.fan_mode, self.data.fan_mode
)
if self.supported_features & ClimateEntityFeature.SWING_MODE:
self._attr_swing_mode = STR_TO_SWING.get(self.data.swing_mode)
if self.supported_features & ClimateEntityFeature.SWING_HORIZONTAL_MODE:
Expand Down Expand Up @@ -266,7 +277,10 @@ async def async_set_fan_mode(self, fan_mode: str) -> None:
fan_mode,
)
await self.async_call_api(
self.coordinator.api.async_set_fan_mode(self.property_id, fan_mode)
self.coordinator.api.async_set_fan_mode(
self.property_id,
HA_FAN_TO_STR.get(fan_mode, fan_mode),
)
)

async def async_set_swing_mode(self, swing_mode: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lg_thinq/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"state": {
"slow": "mdi:fan-chevron-down",
"low": "mdi:fan-speed-1",
"mid": "mdi:fan-speed-2",
"medium": "mdi:fan-speed-2",
"high": "mdi:fan-speed-3",
"power": "mdi:fan-chevron-up",
"auto": "mdi:fan-auto"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lg_thinq/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"state": {
"slow": "Slow",
"low": "[%key:common::state::low%]",
"mid": "[%key:common::state::medium%]",
"medium": "[%key:common::state::medium%]",
"high": "[%key:common::state::high%]",
"power": "[%key:component::lg_thinq::entity::sensor::current_job_mode::state::high%]",
"auto": "[%key:common::state::auto%]"
Expand Down
6 changes: 3 additions & 3 deletions tests/components/lg_thinq/snapshots/test_climate.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'fan_modes': list([
'low',
'high',
'mid',
'medium',
]),
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
Expand Down Expand Up @@ -65,11 +65,11 @@
'attributes': ReadOnlyDict({
'current_humidity': 40,
'current_temperature': 77,
'fan_mode': 'mid',
'fan_mode': 'medium',
'fan_modes': list([
'low',
'high',
'mid',
'medium',
]),
'friendly_name': 'Test air conditioner',
'hvac_modes': list([
Expand Down
Loading