From af14b1b1d6916bb99aa1229e3fbd749424b082e4 Mon Sep 17 00:00:00 2001 From: Semyon Chetvertnyh Date: Sat, 7 Dec 2024 23:04:00 +0100 Subject: [PATCH 1/3] Support `current_humidity` for `climate` --- custom_components/midea_ac_lan/climate.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/midea_ac_lan/climate.py b/custom_components/midea_ac_lan/climate.py index b52d410..716fee5 100644 --- a/custom_components/midea_ac_lan/climate.py +++ b/custom_components/midea_ac_lan/climate.py @@ -156,6 +156,10 @@ def current_temperature(self) -> float | None: """Midea Climate current temperature.""" return cast(float | None, self._device.get_attribute("indoor_temperature")) + @property + def current_humidity(self) -> float | None: + return cast(float, self._device.get_attribute("indoor_humidity")) + @property def preset_mode(self) -> str: """Midea Climate preset mode.""" From 512ecf2f66e31e6016493b9fc15ce7542256450d Mon Sep 17 00:00:00 2001 From: Semyon Chetvertnyh Date: Fri, 13 Dec 2024 10:22:37 +0200 Subject: [PATCH 2/3] Cast to None & add comment --- custom_components/midea_ac_lan/climate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/midea_ac_lan/climate.py b/custom_components/midea_ac_lan/climate.py index 716fee5..ac505a2 100644 --- a/custom_components/midea_ac_lan/climate.py +++ b/custom_components/midea_ac_lan/climate.py @@ -158,7 +158,8 @@ def current_temperature(self) -> float | None: @property def current_humidity(self) -> float | None: - return cast(float, self._device.get_attribute("indoor_humidity")) + """Midea Climate current humidity.""" + return cast(float | None, self._device.get_attribute("indoor_humidity")) @property def preset_mode(self) -> str: From 7064ff3fb64bfe628b01917a2fa91d9d09b60066 Mon Sep 17 00:00:00 2001 From: Semyon Chetvertnyh Date: Mon, 16 Dec 2024 10:24:29 +0200 Subject: [PATCH 3/3] Move from `MideaClimate` to `MideaACClimate` --- custom_components/midea_ac_lan/climate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/midea_ac_lan/climate.py b/custom_components/midea_ac_lan/climate.py index ac505a2..8e4c254 100644 --- a/custom_components/midea_ac_lan/climate.py +++ b/custom_components/midea_ac_lan/climate.py @@ -156,11 +156,6 @@ def current_temperature(self) -> float | None: """Midea Climate current temperature.""" return cast(float | None, self._device.get_attribute("indoor_temperature")) - @property - def current_humidity(self) -> float | None: - """Midea Climate current humidity.""" - return cast(float | None, self._device.get_attribute("indoor_humidity")) - @property def preset_mode(self) -> str: """Midea Climate preset mode.""" @@ -323,6 +318,11 @@ def swing_mode(self) -> str: ) + (2 if self._device.get_attribute(ACAttributes.swing_horizontal) else 0) return self._attr_swing_modes[swing_mode] + @property + def current_humidity(self) -> float | None: + """Midea Climate current humidity.""" + return cast(float | None, self._device.get_attribute("indoor_humidity")) + @property def outdoor_temperature(self) -> float: """Midea AC Climate outdoor temperature."""