From 61b69eb4f51b0f2d98574d006a77a3ed46bc40e6 Mon Sep 17 00:00:00 2001 From: Jack Works Date: Mon, 6 Nov 2023 18:01:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=A1=20add=20option=20"target2current?= =?UTF-8?q?=5Ftemp"=20for=20climate=20(#1185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/climate.py | 2 ++ custom_components/xiaomi_miot/config_flow.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_miot/climate.py b/custom_components/xiaomi_miot/climate.py index a099e169b..092af2d22 100644 --- a/custom_components/xiaomi_miot/climate.py +++ b/custom_components/xiaomi_miot/climate.py @@ -460,6 +460,8 @@ def temperature_unit(self): @property def current_temperature(self): + if self.custom_config('target2current_temp') is True and self.is_on: + return self.target_temperature if ATTR_CURRENT_TEMPERATURE in self._state_attrs: return float(self._state_attrs[ATTR_CURRENT_TEMPERATURE] or 0) if self._prop_temperature: diff --git a/custom_components/xiaomi_miot/config_flow.py b/custom_components/xiaomi_miot/config_flow.py index eda610ab2..167421bfa 100644 --- a/custom_components/xiaomi_miot/config_flow.py +++ b/custom_components/xiaomi_miot/config_flow.py @@ -737,7 +737,7 @@ def get_customize_options(hass, options={}, bool2selects=[], entity_id='', model }) if domain == 'climate' or re.search(r'aircondition|acpartner|airrtc', model, re.I): - bool2selects.extend(['ignore_fan_switch']) + bool2selects.extend(['ignore_fan_switch', 'target2current_temp']) options.update({ 'bind_sensor': cv.string, 'turn_on_hvac': cv.string,