Skip to content

Commit

Permalink
Adjust temperature_unit in hisense_aehw4a1 (#77585)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Aug 31, 2022
1 parent c6b3b9f commit 471878b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions homeassistant/components/hisense_aehw4a1/climate.py
Expand Up @@ -160,7 +160,6 @@ def __init__(self, device):
self._preset_modes = PRESET_MODES
self._available = None
self._on = None
self._temperature_unit = None
self._current_temperature = None
self._target_temperature = None
self._attr_hvac_mode = None
Expand All @@ -185,9 +184,9 @@ async def async_update(self) -> None:
self._on = status["run_status"]

if status["temperature_Fahrenheit"] == "0":
self._temperature_unit = TEMP_CELSIUS
self._attr_temperature_unit = TEMP_CELSIUS
else:
self._temperature_unit = TEMP_FAHRENHEIT
self._attr_temperature_unit = TEMP_FAHRENHEIT

self._current_temperature = int(status["indoor_temperature_status"], 2)

Expand Down Expand Up @@ -237,11 +236,6 @@ def name(self):
"""Return the name of the climate device."""
return self._unique_id

@property
def temperature_unit(self):
"""Return the unit of measurement."""
return self._temperature_unit

@property
def current_temperature(self):
"""Return the current temperature."""
Expand Down Expand Up @@ -285,14 +279,14 @@ def swing_modes(self):
@property
def min_temp(self):
"""Return the minimum temperature."""
if self._temperature_unit == TEMP_CELSIUS:
if self.temperature_unit == TEMP_CELSIUS:
return MIN_TEMP_C
return MIN_TEMP_F

@property
def max_temp(self):
"""Return the maximum temperature."""
if self._temperature_unit == TEMP_CELSIUS:
if self.temperature_unit == TEMP_CELSIUS:
return MAX_TEMP_C
return MAX_TEMP_F

Expand All @@ -312,7 +306,7 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
_LOGGER.debug("Setting temp of %s to %s", self._unique_id, temp)
if self._preset_mode != PRESET_NONE:
await self.async_set_preset_mode(PRESET_NONE)
if self._temperature_unit == TEMP_CELSIUS:
if self.temperature_unit == TEMP_CELSIUS:
await self._device.command(f"temp_{int(temp)}_C")
else:
await self._device.command(f"temp_{int(temp)}_F")
Expand Down

0 comments on commit 471878b

Please sign in to comment.