Skip to content

Commit

Permalink
Fix for #42
Browse files Browse the repository at this point in the history
Removed dependency on deprecated method (temperature utility), as it will break in april 2023. For now, reverted to not converting any temperatures, as the rest of the code only seems to work with Celsius.

Future development; reintroduce temperature conversion, based on TemperatureConverter (home assistant unit_conversion.py in util folder).
  • Loading branch information
kkoenen authored Feb 20, 2023
1 parent ce23f22 commit 6dedb42
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions warmup/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
from homeassistant.exceptions import InvalidStateError, PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.util.temperature import convert as convert_temperature

""" temperature utility will stop working in HA 2023.4. Removed it for now, as CELCIUS is the only temperature standard this module supports anyway. """
# from homeassistant.util.temperature import convert as convert_temperature

DOMAIN = "warmup"
CONFIG_SCHEMA = vol.Schema(
Expand Down Expand Up @@ -313,16 +315,18 @@ def state_attributes(self) -> Dict[str, Any]:
@property
def min_temp(self):
"""Return the minimum temperature."""
return convert_temperature(
self._device.min_temp, TEMP_CELSIUS, self.hass.config.units.temperature_unit
)
# return convert_temperature(
# self._device.min_temp, TEMP_CELSIUS, self.hass.config.units.temperature_unit
# )
return self._device.min_temp

@property
def max_temp(self):
"""Return the maximum temperature."""
return convert_temperature(
self._device.max_temp, TEMP_CELSIUS, self.hass.config.units.temperature_unit
)
# return convert_temperature(
# self._device.max_temp, TEMP_CELSIUS, self.hass.config.units.temperature_unit
# )
return self._device.max_temp

@property
def supported_features(self):
Expand Down

0 comments on commit 6dedb42

Please sign in to comment.