Skip to content

Commit

Permalink
Fix TEMP_CELSIUS deprecation (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZoker authored Dec 29, 2023
1 parent c7b315c commit e385db8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/frigate/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_URL, PERCENTAGE, TEMP_CELSIUS
from homeassistant.const import CONF_URL, PERCENTAGE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -528,7 +528,7 @@ def state(self) -> float | None:
@property
def unit_of_measurement(self) -> Any:
"""Return the unit of measurement of the sensor."""
return TEMP_CELSIUS
return UnitOfTemperature.CELSIUS

@property
def icon(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
ICON_SERVER,
ICON_SPEEDOMETER,
)
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
from homeassistant.const import PERCENTAGE, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
import homeassistant.util.dt as dt_util
Expand Down Expand Up @@ -234,7 +234,7 @@ async def test_coral_temp_sensor(hass: HomeAssistant) -> None:
assert entity_state
assert entity_state.state == "50.0"
assert entity_state.attributes["icon"] == ICON_CORAL
assert entity_state.attributes["unit_of_measurement"] == TEMP_CELSIUS
assert entity_state.attributes["unit_of_measurement"] == UnitOfTemperature.CELSIUS

stats: dict[str, Any] = copy.deepcopy(TEST_STATS)
client.async_get_stats = AsyncMock(return_value=stats)
Expand Down

0 comments on commit e385db8

Please sign in to comment.