Skip to content

Commit

Permalink
Merge pull request #79 from mill1000/issue/constants
Browse files Browse the repository at this point in the history
Replace deprecated usage of TEMP_ constants
  • Loading branch information
mill1000 authored Jan 22, 2024
2 parents d7884e5 + 7e7874d commit 789552f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions custom_components/midea_ac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
ClimateEntityFeature,
HVACMode)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (ATTR_TEMPERATURE, CONF_ENABLED, TEMP_CELSIUS,
TEMP_FAHRENHEIT)
from homeassistant.const import (ATTR_TEMPERATURE, CONF_ENABLED,
UnitOfTemperature)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import entity_platform
Expand Down Expand Up @@ -176,7 +176,7 @@ async def _apply(self) -> None:

# Display on the AC should use the same unit as homeassistant
helpers.set_properties(self._device, ["fahrenheit", "fahrenheit_unit"],
self.hass.config.units.temperature_unit == TEMP_FAHRENHEIT)
self.hass.config.units.temperature_unit == UnitOfTemperature.FAHRENHEIT)

# Apply via the coordinator
await self.coordinator.apply()
Expand Down Expand Up @@ -241,7 +241,7 @@ def target_temperature_step(self) -> float | None:
@property
def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS

@ property
def min_temp(self) -> float:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/midea_ac/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from homeassistant.components.sensor import (SensorDeviceClass, SensorEntity,
SensorStateClass)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS
from homeassistant.const import UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

Expand Down Expand Up @@ -87,7 +87,7 @@ def state_class(self) -> str:
@property
def native_unit_of_measurement(self) -> str:
"""Return the native units pf this entity."""
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS

@property
def native_value(self) -> float | None:
Expand Down

0 comments on commit 789552f

Please sign in to comment.