diff --git a/custom_components/climate_ip/climate.py b/custom_components/climate_ip/climate.py index e7ee32c..d161af1 100755 --- a/custom_components/climate_ip/climate.py +++ b/custom_components/climate_ip/climate.py @@ -29,8 +29,8 @@ ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, - HVACMode.OFF, ClimateEntity, + HVACMode, ) from homeassistant.components.climate.const import ( ATTR_MAX_TEMP, @@ -50,8 +50,7 @@ STATE_ON, STATE_UNAVAILABLE, STATE_UNKNOWN, - UnitOfTemperature.CELSIUS, - UnitOfTemperature.FAHRENHEIT, + UnitOfTemperature, ) from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers.config_validation import PLATFORM_SCHEMA @@ -230,14 +229,18 @@ def min_temp(self): t = self.rac.get_property(ATTR_MIN_TEMP) if t is None: t = DEFAULT_CLIMATE_IP_TEMP_MIN - return TemperatureConverter.convert(t, UnitOfTemperature.CELSIUS, self.temperature_unit) + return TemperatureConverter.convert( + t, UnitOfTemperature.CELSIUS, self.temperature_unit + ) @property def max_temp(self): t = self.rac.get_property(ATTR_MAX_TEMP) if t is None: t = DEFAULT_CLIMATE_IP_TEMP_MAX - return TemperatureConverter.convert(t, UnitOfTemperature.CELSIUS, self.temperature_unit) + return TemperatureConverter.convert( + t, UnitOfTemperature.CELSIUS, self.temperature_unit + ) @property def should_poll(self): diff --git a/custom_components/climate_ip/controller_yaml.py b/custom_components/climate_ip/controller_yaml.py index aae9c63..67c4f77 100755 --- a/custom_components/climate_ip/controller_yaml.py +++ b/custom_components/climate_ip/controller_yaml.py @@ -16,7 +16,7 @@ CONF_TEMPERATURE_UNIT, CONF_TOKEN, STATE_ON, - UnitOfTemperature.CELSIUS, + UnitOfTemperature, ) from homeassistant.helpers.config_validation import PLATFORM_SCHEMA diff --git a/custom_components/climate_ip/properties.py b/custom_components/climate_ip/properties.py index ede7845..fdca6fe 100755 --- a/custom_components/climate_ip/properties.py +++ b/custom_components/climate_ip/properties.py @@ -1,13 +1,7 @@ import json import homeassistant.helpers.config_validation as cv -from homeassistant.const import ( - STATE_OFF, - STATE_ON, - STATE_UNKNOWN, - UnitOfTemperature.CELSIUS, - UnitOfTemperature.FAHRENHEIT, -) +from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNKNOWN, UnitOfTemperature # from homeassistant.util.temperature import convert as convert_temperature from homeassistant.util.unit_conversion import TemperatureConverter @@ -502,7 +496,9 @@ def update_state(self, device_state, debug): def convert_dev_to_hass(self, dev_value): """Convert device state value to HASS.""" - return TemperatureConverter.convert(float(dev_value), self._unit, UnitOfTemperature.CELSIUS) + return TemperatureConverter.convert( + float(dev_value), self._unit, UnitOfTemperature.CELSIUS + ) def convert_hass_to_dev(self, hass_value): v = hass_value @@ -512,4 +508,6 @@ def convert_hass_to_dev(self, hass_value): if self._max is not None and hass_value > self._max: v = self._max - return TemperatureConverter.convert(float(v), UnitOfTemperature.CELSIUS, self._unit) + return TemperatureConverter.convert( + float(v), UnitOfTemperature.CELSIUS, self._unit + )