From ed66d3cc06138b31de0f960e763fc5cb4423bd14 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 25 Oct 2023 14:17:58 -0600 Subject: [PATCH] Fix temperature conversion deprecation --- custom_components/plant/number.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/plant/number.py b/custom_components/plant/number.py index f1d8ef0..1376189 100644 --- a/custom_components/plant/number.py +++ b/custom_components/plant/number.py @@ -24,7 +24,7 @@ ) from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.event import async_track_state_change_event -from homeassistant.util.temperature import convert as convert_temperature +from homeassistant.util.unit_conversion import TemperatureConverter from .const import ( ATTR_CONDUCTIVITY, @@ -350,7 +350,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°C" ): new_state = round( - convert_temperature( + TemperatureConerter.convert( temperature=float(self.state), from_unit=TEMP_FAHRENHEIT, to_unit=TEMP_CELSIUS, @@ -367,7 +367,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°F" ): new_state = round( - convert_temperature( + TemperatureConerter.convert( temperature=float(self.state), from_unit=TEMP_CELSIUS, to_unit=TEMP_FAHRENHEIT, @@ -422,7 +422,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°C" ): new_state = round( - convert_temperature( + TemperatureConerter.convert( temperature=float(self.state), from_unit=TEMP_FAHRENHEIT, to_unit=TEMP_CELSIUS, @@ -441,7 +441,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°F" ): new_state = round( - convert_temperature( + TemperatureConerter.convert( temperature=float(self.state), from_unit=TEMP_CELSIUS, to_unit=TEMP_FAHRENHEIT,