diff --git a/custom_components/plant/plant_thresholds.py b/custom_components/plant/plant_thresholds.py index b68ab1f..d898186 100644 --- a/custom_components/plant/plant_thresholds.py +++ b/custom_components/plant/plant_thresholds.py @@ -12,8 +12,7 @@ LIGHT_LUX, PERCENTAGE, STATE_UNKNOWN, - TEMP_CELSIUS, - TEMP_FAHRENHEIT, + UnitOfTemperature, ) from homeassistant.core import Event, HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -282,8 +281,8 @@ def state_attributes_changed(self, old_attributes, new_attributes): new_state = round( TemperatureConverter.convert( temperature=float(self.state), - from_unit=TEMP_FAHRENHEIT, - to_unit=TEMP_CELSIUS, + from_unit=UnitOfTemperature.FAHRENHEIT, + to_unit=UnitOfTemperature.CELSIUS, ) ) _LOGGER.debug( @@ -299,8 +298,8 @@ def state_attributes_changed(self, old_attributes, new_attributes): new_state = round( TemperatureConverter.convert( temperature=float(self.state), - from_unit=TEMP_CELSIUS, - to_unit=TEMP_FAHRENHEIT, + from_unit=UnitOfTemperature.CELSIUS, + to_unit=UnitOfTemperature.FAHRENHEIT, ) ) _LOGGER.debug( @@ -374,8 +373,8 @@ def state_attributes_changed(self, old_attributes, new_attributes): new_state = round( TemperatureConverter.convert( temperature=float(self.state), - from_unit=TEMP_FAHRENHEIT, - to_unit=TEMP_CELSIUS, + from_unit=UnitOfTemperature.FAHRENHEIT, + to_unit=UnitOfTemperature.CELSIUS, ) ) _LOGGER.debug( @@ -393,8 +392,8 @@ def state_attributes_changed(self, old_attributes, new_attributes): new_state = round( TemperatureConverter.convert( temperature=float(self.state), - from_unit=TEMP_CELSIUS, - to_unit=TEMP_FAHRENHEIT, + from_unit=UnitOfTemperature.CELSIUS, + to_unit=UnitOfTemperature.FAHRENHEIT, ) ) _LOGGER.debug(