Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust temperature_unit in hisense_aehw4a1 #77585

Merged
merged 2 commits into from Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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