Adjust temperature_unit in hisense_aehw4a1 (#77585)

This commit is contained in:
epenet 2022-08-31 22:05:31 +02:00 committed by GitHub
parent c6b3b9fa90
commit 471878b5fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,7 +160,6 @@ class ClimateAehW4a1(ClimateEntity):
self._preset_modes = PRESET_MODES self._preset_modes = PRESET_MODES
self._available = None self._available = None
self._on = None self._on = None
self._temperature_unit = None
self._current_temperature = None self._current_temperature = None
self._target_temperature = None self._target_temperature = None
self._attr_hvac_mode = None self._attr_hvac_mode = None
@ -185,9 +184,9 @@ class ClimateAehW4a1(ClimateEntity):
self._on = status["run_status"] self._on = status["run_status"]
if status["temperature_Fahrenheit"] == "0": if status["temperature_Fahrenheit"] == "0":
self._temperature_unit = TEMP_CELSIUS self._attr_temperature_unit = TEMP_CELSIUS
else: else:
self._temperature_unit = TEMP_FAHRENHEIT self._attr_temperature_unit = TEMP_FAHRENHEIT
self._current_temperature = int(status["indoor_temperature_status"], 2) self._current_temperature = int(status["indoor_temperature_status"], 2)
@ -237,11 +236,6 @@ class ClimateAehW4a1(ClimateEntity):
"""Return the name of the climate device.""" """Return the name of the climate device."""
return self._unique_id return self._unique_id
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return self._temperature_unit
@property @property
def current_temperature(self): def current_temperature(self):
"""Return the current temperature.""" """Return the current temperature."""
@ -285,14 +279,14 @@ class ClimateAehW4a1(ClimateEntity):
@property @property
def min_temp(self): def min_temp(self):
"""Return the minimum temperature.""" """Return the minimum temperature."""
if self._temperature_unit == TEMP_CELSIUS: if self.temperature_unit == TEMP_CELSIUS:
return MIN_TEMP_C return MIN_TEMP_C
return MIN_TEMP_F return MIN_TEMP_F
@property @property
def max_temp(self): def max_temp(self):
"""Return the maximum temperature.""" """Return the maximum temperature."""
if self._temperature_unit == TEMP_CELSIUS: if self.temperature_unit == TEMP_CELSIUS:
return MAX_TEMP_C return MAX_TEMP_C
return MAX_TEMP_F return MAX_TEMP_F
@ -312,7 +306,7 @@ class ClimateAehW4a1(ClimateEntity):
_LOGGER.debug("Setting temp of %s to %s", self._unique_id, temp) _LOGGER.debug("Setting temp of %s to %s", self._unique_id, temp)
if self._preset_mode != PRESET_NONE: if self._preset_mode != PRESET_NONE:
await self.async_set_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") await self._device.command(f"temp_{int(temp)}_C")
else: else:
await self._device.command(f"temp_{int(temp)}_F") await self._device.command(f"temp_{int(temp)}_F")