Remove useless function get_ufp_event from unifiprotect (#119906)

pull/117461/head
J. Nick Koston 2024-06-18 12:29:26 -05:00 committed by GitHub
parent 407df2aedf
commit d2faaa1531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 9 deletions

View File

@ -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(