From bd2ad4e2f727689015ffb984b77c8017e2aebba6 Mon Sep 17 00:00:00 2001 From: Dion de Koning Date: Tue, 7 Nov 2023 11:16:19 +0100 Subject: [PATCH] Fix temperature deprication --- custom_components/plant/plant_thresholds.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/plant/plant_thresholds.py b/custom_components/plant/plant_thresholds.py index c34861f..b68ab1f 100644 --- a/custom_components/plant/plant_thresholds.py +++ b/custom_components/plant/plant_thresholds.py @@ -24,7 +24,7 @@ ) from homeassistant.helpers.event import async_track_state_change_event from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.util.temperature import convert as convert_temperature +from homeassistant.util.unit_conversion import TemperatureConverter from .const import ( ATTR_CONDUCTIVITY, @@ -280,7 +280,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°C" ): new_state = round( - convert_temperature( + TemperatureConverter.convert( temperature=float(self.state), from_unit=TEMP_FAHRENHEIT, to_unit=TEMP_CELSIUS, @@ -297,7 +297,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°F" ): new_state = round( - convert_temperature( + TemperatureConverter.convert( temperature=float(self.state), from_unit=TEMP_CELSIUS, to_unit=TEMP_FAHRENHEIT, @@ -372,7 +372,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°C" ): new_state = round( - convert_temperature( + TemperatureConverter.convert( temperature=float(self.state), from_unit=TEMP_FAHRENHEIT, to_unit=TEMP_CELSIUS, @@ -391,7 +391,7 @@ def state_attributes_changed(self, old_attributes, new_attributes): and new_attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "°F" ): new_state = round( - convert_temperature( + TemperatureConverter.convert( temperature=float(self.state), from_unit=TEMP_CELSIUS, to_unit=TEMP_FAHRENHEIT,