From 93292d9a8d59f08e840f19b7712048c8afb3e055 Mon Sep 17 00:00:00 2001 From: Necroneco Date: Sat, 1 Jun 2024 22:59:52 +0800 Subject: [PATCH] fix: revert some changes from #53 --- custom_components/midea_ac_lan/climate.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/custom_components/midea_ac_lan/climate.py b/custom_components/midea_ac_lan/climate.py index c68130a0..c57bddf5 100644 --- a/custom_components/midea_ac_lan/climate.py +++ b/custom_components/midea_ac_lan/climate.py @@ -155,8 +155,8 @@ def target_temperature(self) -> float: return cast(float, self._device.get_attribute("target_temperature")) @property - def current_temperature(self) -> float: - return cast(float, self._device.get_attribute("indoor_temperature")) + def current_temperature(self) -> float | None: + return cast(float | None, self._device.get_attribute("indoor_temperature")) @property def preset_modes(self) -> list[str]: @@ -417,15 +417,16 @@ def current_temperature(self) -> float: class MideaC3Climate(MideaClimate): - def __init__(self, device: Any, entity_key: str, zone: str) -> None: + _powers = [ + C3Attributes.zone1_power, + C3Attributes.zone2_power, + ] + + def __init__(self, device: Any, entity_key: str, zone: int) -> None: super().__init__(device, entity_key) self._zone = zone self._modes = [HVACMode.OFF, HVACMode.AUTO, HVACMode.COOL, HVACMode.HEAT] - self._power_attr = ( - C3Attributes.zone1_power - if zone == "zone1_power" - else C3Attributes.zone2_power - ) + self._power_attr = MideaC3Climate._powers[zone] @property def supported_features(self) -> ClimateEntityFeature: @@ -489,8 +490,8 @@ def target_temperature(self) -> float: ) @property - def current_temperature(self) -> float: - return 0 + def current_temperature(self) -> float | None: + return None def set_temperature(self, **kwargs: Any) -> None: if ATTR_TEMPERATURE not in kwargs: