Skip to content

Commit

Permalink
refactor: improve ac unit processing
Browse files Browse the repository at this point in the history
  • Loading branch information
rxwen committed Nov 6, 2023
1 parent 4964709 commit 556ef55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions custom_components/terncy/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/terncy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-*"}
]
Expand Down

0 comments on commit 556ef55

Please sign in to comment.