Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Dec 29, 2023
2 parents cd06f20 + 911c830 commit e210f9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions custom_components/frigate/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ def extra_state_attributes(self) -> dict[str, str]:
}

@property
def supported_features(self) -> int:
def supported_features(self) -> CameraEntityFeature:
"""Return supported features of this camera."""
if not self._attr_is_streaming:
return 0
return CameraEntityFeature(0)

return cast(int, CameraEntityFeature.STREAM)
return CameraEntityFeature.STREAM

async def async_camera_image(
self, width: int | None = None, height: int | None = None
Expand Down Expand Up @@ -446,9 +446,9 @@ def device_info(self) -> dict[str, Any]:
}

@property
def supported_features(self) -> int:
def supported_features(self) -> CameraEntityFeature:
"""Return supported features of this camera."""
return cast(int, CameraEntityFeature.STREAM)
return CameraEntityFeature.STREAM

async def async_camera_image(
self, width: int | None = None, height: int | None = None
Expand Down
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 @@ -538,7 +538,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
7 changes: 4 additions & 3 deletions tests/test_media_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,10 @@ async def test_async_resolve_media(

# Convert from HA local timezone to UTC.
info = await system_info.async_get_system_info(hass)
date = datetime.datetime(2021, 5, 30, 15, 46, 8)
date = pytz.timezone(info.get("timezone", "utc")).localize(date)
date = date.astimezone(pytz.utc)
date = datetime.datetime(2021, 5, 30, 15, 46, 8, 0, datetime.timezone.utc) - (
datetime.datetime.now(pytz.timezone(info.get("timezone", "utc"))).utcoffset()
or datetime.timedelta()
)

assert media == PlayMedia(
url=(
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 e210f9f

Please sign in to comment.