From 556ef55d44b11f0451bd7ea7e8c0c1b1c19455e6 Mon Sep 17 00:00:00 2001 From: ruixiongwen Date: Mon, 6 Nov 2023 16:04:34 +0800 Subject: [PATCH] refactor: improve ac unit processing --- custom_components/terncy/climate.py | 5 ++--- custom_components/terncy/manifest.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/custom_components/terncy/climate.py b/custom_components/terncy/climate.py index c14a7d5..ac4c726 100644 --- a/custom_components/terncy/climate.py +++ b/custom_components/terncy/climate.py @@ -70,13 +70,12 @@ class TerncyClimate(TerncyEntity, ClimateEntity): _attr_target_temperature_step: float | None = 1 # _attr_temperature_unit: str = UnitOfTemperature.CELSIUS _attr_temperature_unit: str = TEMP_CELSIUS # <2022.11 - _current_temp_unit: float = 1 def update_state(self, attrs): # _LOGGER.debug("%s <= %s", self.eid, attrs) if (temp_unit := get_attr_value(attrs, K_AC_TEMP_UNIT)) is not None: if temp_unit == 1: - self._current_temp_unit: float = 10 + self._attr_precision: float = 0.1 if (ac_mode := get_attr_value(attrs, K_AC_MODE)) is not None: if ac_mode == 1: self._attr_hvac_mode = HVACMode.COOL @@ -105,7 +104,7 @@ def update_state(self, attrs): if ( current_temperature := get_attr_value(attrs, K_AC_CURRENT_TEMPERATURE) ) is not None: - self._attr_current_temperature = current_temperature / self._current_temp_unit + self._attr_current_temperature = current_temperature * self._attr_precision if ( target_temperature := get_attr_value(attrs, K_AC_TARGET_TEMPERATURE) diff --git a/custom_components/terncy/manifest.json b/custom_components/terncy/manifest.json index e114117..3fe456e 100644 --- a/custom_components/terncy/manifest.json +++ b/custom_components/terncy/manifest.json @@ -12,7 +12,7 @@ "iot_class": "local_push", "issue_tracker": "https://github.com/rxwen/homeassistant-terncy-component/issues", "requirements": ["terncy==0.3.5","websockets>=10.3","zeroconf>=0.28.8"], - "version": "1.0.32", + "version": "1.0.33", "zeroconf": [ {"type":"_websocket._tcp.local.","name":"box-*"} ]