From d2faaa15315636542547f5456dea937e8a4cbb36 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 18 Jun 2024 12:29:26 -0500 Subject: [PATCH] Remove useless function get_ufp_event from unifiprotect (#119906) --- .../components/unifiprotect/media_source.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/unifiprotect/media_source.py b/homeassistant/components/unifiprotect/media_source.py index d6acb876c94..a646c037d62 100644 --- a/homeassistant/components/unifiprotect/media_source.py +++ b/homeassistant/components/unifiprotect/media_source.py @@ -81,12 +81,6 @@ EVENT_NAME_MAP = { } -def get_ufp_event(event_type: SimpleEventType) -> set[EventType]: - """Get UniFi Protect event type from SimpleEventType.""" - - return EVENT_MAP[event_type] - - async def async_get_media_source(hass: HomeAssistant) -> MediaSource: """Set up UniFi Protect media source.""" return ProtectMediaSource( @@ -488,7 +482,7 @@ class ProtectMediaSource(MediaSource): ) -> list[BrowseMediaSource]: """Build media source for a given range of time and event type.""" - event_types = event_types or get_ufp_event(SimpleEventType.ALL) + event_types = event_types or EVENT_MAP[SimpleEventType.ALL] types = list(event_types) sources: list[BrowseMediaSource] = [] events = await data.api.get_events_raw( @@ -554,7 +548,7 @@ class ProtectMediaSource(MediaSource): start=now - timedelta(days=days), end=now, camera_id=event_camera_id, - event_types=get_ufp_event(event_type), + event_types=EVENT_MAP[event_type], reserve=True, ) source.children = events @@ -686,7 +680,7 @@ class ProtectMediaSource(MediaSource): end=end_dt, camera_id=event_camera_id, reserve=False, - event_types=get_ufp_event(event_type), + event_types=EVENT_MAP[event_type], ) source.children = events source.title = self._breadcrumb(