From 6dedb4208d76d065efcc47147d40e6862bed75e1 Mon Sep 17 00:00:00 2001 From: Kees Koenen Date: Mon, 20 Feb 2023 22:45:09 +0100 Subject: [PATCH] Fix for #42 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). --- warmup/climate.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/warmup/climate.py b/warmup/climate.py index d0bdc34..7dbde49 100644 --- a/warmup/climate.py +++ b/warmup/climate.py @@ -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( @@ -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):