From bc9b134c5d4c2e0690b798277fedeba8f230097a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 19 Oct 2021 21:04:46 +0200 Subject: [PATCH] Clean up self references from Tuya climate platform constructor (#58051) --- homeassistant/components/tuya/climate.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index 1ba061463f5..b26ff34bc6d 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -252,7 +252,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): ): self._current_humidity_dpcode = DPCode.HUMIDITY_CURRENT self._current_humidity_type = IntegerTypeData.from_json( - self.device.status_range[DPCode.HUMIDITY_CURRENT].values + device.status_range[DPCode.HUMIDITY_CURRENT].values ) # Determine dpcode to use for getting the current humidity @@ -262,7 +262,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): ): self._current_humidity_dpcode = DPCode.HUMIDITY_CURRENT self._current_humidity_type = IntegerTypeData.from_json( - self.device.status_range[DPCode.HUMIDITY_CURRENT].values + device.status_range[DPCode.HUMIDITY_CURRENT].values ) # Determine fan modes @@ -272,12 +272,12 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): ): self._attr_supported_features |= SUPPORT_FAN_MODE self._attr_fan_modes = EnumTypeData.from_json( - self.device.status_range[DPCode.FAN_SPEED_ENUM].values + device.status_range[DPCode.FAN_SPEED_ENUM].values ).range # Determine swing modes if any( - dpcode in self.device.function + dpcode in device.function for dpcode in ( DPCode.SHAKE, DPCode.SWING, @@ -288,15 +288,14 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): self._attr_supported_features |= SUPPORT_SWING_MODE self._attr_swing_modes = [SWING_OFF] if any( - dpcode in self.device.function - for dpcode in (DPCode.SHAKE, DPCode.SWING) + dpcode in device.function for dpcode in (DPCode.SHAKE, DPCode.SWING) ): self._attr_swing_modes.append(SWING_ON) - if DPCode.SWITCH_HORIZONTAL in self.device.function: + if DPCode.SWITCH_HORIZONTAL in device.function: self._attr_swing_modes.append(SWING_HORIZONTAL) - if DPCode.SWITCH_VERTICAL in self.device.function: + if DPCode.SWITCH_VERTICAL in device.function: self._attr_swing_modes.append(SWING_VERTICAL) def set_hvac_mode(self, hvac_mode: str) -> None: