diff --git a/homeassistant/components/nest/media_source.py b/homeassistant/components/nest/media_source.py index 098d7d01b0f..328a9b000b3 100644 --- a/homeassistant/components/nest/media_source.py +++ b/homeassistant/components/nest/media_source.py @@ -24,7 +24,7 @@ import logging from google_nest_sdm.camera_traits import CameraClipPreviewTrait, CameraEventImageTrait from google_nest_sdm.device import Device -from google_nest_sdm.event import ImageEventBase +from google_nest_sdm.event import EventImageType, ImageEventBase from homeassistant.components.media_player.const import ( MEDIA_CLASS_DIRECTORY, @@ -254,7 +254,7 @@ def _browse_event( event_name=MEDIA_SOURCE_EVENT_TITLE_MAP.get(event.event_type, "Event"), event_time=dt_util.as_local(event.timestamp).strftime(DATE_STR_FORMAT), ), - can_play=True, + can_play=(event.event_image_type == EventImageType.CLIP_PREVIEW), can_expand=False, thumbnail=None, children=[], diff --git a/tests/components/nest/test_media_source.py b/tests/components/nest/test_media_source.py index 22ed0721eb2..f52b89c4f4d 100644 --- a/tests/components/nest/test_media_source.py +++ b/tests/components/nest/test_media_source.py @@ -231,6 +231,7 @@ async def test_camera_event(hass, auth, hass_client): assert "Person" in browse.title assert not browse.can_expand assert not browse.children + assert not browse.can_play # Resolving the event links to the media media = await media_source.async_resolve_media( @@ -302,6 +303,7 @@ async def test_event_order(hass, auth): event_timestamp_string = event_timestamp2.strftime(DATE_STR_FORMAT) assert browse.children[0].title == f"Motion @ {event_timestamp_string}" assert not browse.children[0].can_expand + assert not browse.can_play # Person event is next assert browse.children[1].domain == DOMAIN @@ -310,6 +312,7 @@ async def test_event_order(hass, auth): event_timestamp_string = event_timestamp1.strftime(DATE_STR_FORMAT) assert browse.children[1].title == f"Person @ {event_timestamp_string}" assert not browse.children[1].can_expand + assert not browse.can_play async def test_browse_invalid_device_id(hass, auth): @@ -449,6 +452,7 @@ async def test_camera_event_clip_preview(hass, auth, hass_client): assert browse.children[0].title == f"Motion @ {event_timestamp_string}" assert not browse.children[0].can_expand assert len(browse.children[0].children) == 0 + assert browse.children[0].can_play # Resolving the event links to the media media = await media_source.async_resolve_media(