mirror of
https://github.com/home-assistant/core.git
synced 2025-09-04 04:11:37 +02:00
Modified to use built-in fan modes for "mid". (#150927)
Co-authored-by: yunseon.park <yunseon.park@lge.com>
This commit is contained in:
committed by
GitHub
parent
207e2f61ea
commit
af951ff0d4
@@ -12,6 +12,7 @@ from homeassistant.components.climate import (
|
||||
ATTR_HVAC_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
FAN_MEDIUM,
|
||||
PRESET_NONE,
|
||||
SWING_OFF,
|
||||
SWING_ON,
|
||||
@@ -64,6 +65,12 @@ STR_TO_SWING = {
|
||||
|
||||
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__)
|
||||
|
||||
|
||||
@@ -124,7 +131,9 @@ class ThinQClimateEntity(ThinQEntity, ClimateEntity):
|
||||
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
|
||||
|
||||
@@ -148,7 +157,9 @@ class ThinQClimateEntity(ThinQEntity, ClimateEntity):
|
||||
|
||||
# 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:
|
||||
@@ -266,7 +277,10 @@ class ThinQClimateEntity(ThinQEntity, ClimateEntity):
|
||||
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:
|
||||
|
@@ -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"
|
||||
|
@@ -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%]"
|
||||
|
@@ -8,7 +8,7 @@
|
||||
'fan_modes': list([
|
||||
'low',
|
||||
'high',
|
||||
'mid',
|
||||
'medium',
|
||||
]),
|
||||
'hvac_modes': list([
|
||||
<HVACMode.OFF: 'off'>,
|
||||
@@ -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([
|
||||
|
Reference in New Issue
Block a user