1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Rename attribute in Tuya climate wrapper (#159145)

This commit is contained in:
epenet
2025-12-18 10:02:38 +01:00
committed by GitHub
parent f9a070e9b3
commit af3861cd6b

View File

@@ -68,7 +68,7 @@ class _SwingModeWrapper(DeviceWrapper):
on_off: DPCodeBooleanWrapper | None = None on_off: DPCodeBooleanWrapper | None = None
horizontal: DPCodeBooleanWrapper | None = None horizontal: DPCodeBooleanWrapper | None = None
vertical: DPCodeBooleanWrapper | None = None vertical: DPCodeBooleanWrapper | None = None
modes: list[str] options: list[str]
@classmethod @classmethod
def find_dpcode(cls, device: CustomerDevice) -> Self | None: def find_dpcode(cls, device: CustomerDevice) -> Self | None:
@@ -83,18 +83,18 @@ class _SwingModeWrapper(DeviceWrapper):
device, DPCode.SWITCH_VERTICAL, prefer_function=True device, DPCode.SWITCH_VERTICAL, prefer_function=True
) )
if on_off or horizontal or vertical: if on_off or horizontal or vertical:
modes = [SWING_OFF] options = [SWING_OFF]
if on_off: if on_off:
modes.append(SWING_ON) options.append(SWING_ON)
if horizontal: if horizontal:
modes.append(SWING_HORIZONTAL) options.append(SWING_HORIZONTAL)
if vertical: if vertical:
modes.append(SWING_VERTICAL) options.append(SWING_VERTICAL)
return cls( return cls(
on_off=on_off, on_off=on_off,
horizontal=horizontal, horizontal=horizontal,
vertical=vertical, vertical=vertical,
modes=modes, options=options,
) )
return None return None
@@ -403,7 +403,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
# Determine swing modes # Determine swing modes
if swing_wrapper: if swing_wrapper:
self._attr_supported_features |= ClimateEntityFeature.SWING_MODE self._attr_supported_features |= ClimateEntityFeature.SWING_MODE
self._attr_swing_modes = swing_wrapper.modes self._attr_swing_modes = swing_wrapper.options
if switch_wrapper: if switch_wrapper:
self._attr_supported_features |= ( self._attr_supported_features |= (