From 25b35388693dfbe8142ca1520b51477d390954e2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 2 Dec 2026 02:59:01 -0500 Subject: [PATCH] Use the MIME type as the Nest event media content type (#195931) Co-authored-by: Claude Opus 5.5 --- homeassistant/components/nest/media_source.py | 5 +++-- tests/components/nest/test_media_source.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/nest/media_source.py b/homeassistant/components/nest/media_source.py index eb66a266a2a0..9db6cd0cea75 100644 --- a/homeassistant/components/nest/media_source.py +++ b/homeassistant/components/nest/media_source.py @@ -608,7 +608,8 @@ def _browse_clip_preview( domain=DOMAIN, identifier=event_id.identifier, media_class=MediaClass.IMAGE, - media_content_type=MediaType.IMAGE, + # Media pickers filter on MIME types, such as image/*. + media_content_type=EventImageType.CLIP_PREVIEW.content_type, title=CLIP_TITLE_FORMAT.format( event_name=", ".join(types), event_time=dt_util.as_local(event.timestamp).strftime(DATE_STR_FORMAT), @@ -630,7 +631,7 @@ def _browse_image_event( domain=DOMAIN, identifier=event_id.identifier, media_class=MediaClass.IMAGE, - media_content_type=MediaType.IMAGE, + media_content_type=EventImageType.IMAGE.content_type, title=CLIP_TITLE_FORMAT.format( event_name=MEDIA_SOURCE_EVENT_TITLE_MAP.get(event.event_type, "Event"), event_time=dt_util.as_local(event.timestamp).strftime(DATE_STR_FORMAT), diff --git a/tests/components/nest/test_media_source.py b/tests/components/nest/test_media_source.py index cc80b733b629..188f04627d1c 100644 --- a/tests/components/nest/test_media_source.py +++ b/tests/components/nest/test_media_source.py @@ -400,6 +400,7 @@ async def test_camera_event( assert browse.domain == DOMAIN assert browse.identifier == f"{device.id}/{event_identifier}" assert "Person" in browse.title + assert browse.media_content_type == "image/jpeg" assert not browse.can_expand assert not browse.children assert not browse.can_play @@ -915,6 +916,7 @@ async def test_camera_event_clip_preview( assert browse.domain == DOMAIN event_timestamp_string = event_timestamp.strftime(DATE_STR_FORMAT) assert browse.title == f"Motion @ {event_timestamp_string}" + assert browse.media_content_type == "video/mp4" assert not browse.can_expand assert len(browse.children) == 0 assert browse.can_play