Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.nest.media_source Namespace Reference

Classes

class  MediaId
 
class  NestEventMediaStore
 
class  NestMediaSource
 

Functions

dict[str, ClipPreviewSession] _async_get_clip_preview_sessions (Device device)
 
dict[str, ImageSession] _async_get_image_sessions (Device device)
 
MediaId|None _async_get_recent_event_id (MediaId device_id, Device device)
 
BrowseMediaSource _browse_clip_preview (MediaId event_id, Device device, ClipPreviewSession event)
 
BrowseMediaSource _browse_device (MediaId device_id, Device device)
 
BrowseMediaSource _browse_image_event (MediaId event_id, Device device, ImageSession event)
 
BrowseMediaSource _browse_root ()
 
EventMediaStore async_get_media_event_store (HomeAssistant hass, GoogleNestSubscriber subscriber)
 
MediaSource async_get_media_source (HomeAssistant hass)
 
Mapping[str, Device] async_get_media_source_devices (HomeAssistant hass)
 
Transcoder async_get_transcoder (HomeAssistant hass)
 
MediaId|None parse_media_id (str|None identifier=None)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string CLIP_TITLE_FORMAT = "{event_name} @ {event_time}"
 
string DEVICE_TITLE_FORMAT = "{device_name}: Recent Events"
 
int DISK_READ_LRU_MAX_SIZE = 32
 
string EVENT_MEDIA_API_URL_FORMAT = "/api/nest/event_media/{device_id}/{event_token}"
 
string EVENT_THUMBNAIL_URL_FORMAT = "/api/nest/event_media/{device_id}/{event_token}/thumbnail"
 
string MEDIA_PATH = f"{DOMAIN}/event_media"
 
string MEDIA_SOURCE_TITLE = "Nest"
 
string STORAGE_KEY = "nest.event_media"
 
int STORAGE_SAVE_DELAY_SECONDS = 120
 
int STORAGE_VERSION = 1
 

Detailed Description

Nest Media Source implementation.

The Nest MediaSource implementation provides a directory tree of devices and
events and associated media (e.g. an image or clip). Camera device events
publish an event message, received by the subscriber library. Media for an
event, such as camera image or clip, may be fetched from the cloud during a
short time window after the event happens.

The actual management of associating events to devices, fetching media for
events, caching, and the overall lifetime of recent events are managed outside
of the Nest MediaSource.

Users may also record clips to local storage, unrelated to this MediaSource.

For additional background on Nest Camera events see:
https://developers.google.com/nest/device-access/api/camera#handle_camera_events

Function Documentation

◆ _async_get_clip_preview_sessions()

dict[str, ClipPreviewSession] homeassistant.components.nest.media_source._async_get_clip_preview_sessions ( Device  device)
private
Return clip preview sessions for the device.

Definition at line 427 of file media_source.py.

◆ _async_get_image_sessions()

dict[str, ImageSession] homeassistant.components.nest.media_source._async_get_image_sessions ( Device  device)
private
Return image events for the device.

Definition at line 435 of file media_source.py.

◆ _async_get_recent_event_id()

MediaId | None homeassistant.components.nest.media_source._async_get_recent_event_id ( MediaId  device_id,
Device   device 
)
private
Return thumbnail for most recent device event.

Definition at line 457 of file media_source.py.

◆ _browse_clip_preview()

BrowseMediaSource homeassistant.components.nest.media_source._browse_clip_preview ( MediaId  event_id,
Device  device,
ClipPreviewSession   event 
)
private
Build a BrowseMediaSource for a specific clip preview event.

Definition at line 489 of file media_source.py.

◆ _browse_device()

BrowseMediaSource homeassistant.components.nest.media_source._browse_device ( MediaId  device_id,
Device  device 
)
private
Return details for the specified device.

Definition at line 472 of file media_source.py.

◆ _browse_image_event()

BrowseMediaSource homeassistant.components.nest.media_source._browse_image_event ( MediaId  event_id,
Device  device,
ImageSession   event 
)
private
Build a BrowseMediaSource for a specific image event.

Definition at line 515 of file media_source.py.

◆ _browse_root()

BrowseMediaSource homeassistant.components.nest.media_source._browse_root ( )
private
Return devices in the root.

Definition at line 441 of file media_source.py.

◆ async_get_media_event_store()

EventMediaStore homeassistant.components.nest.media_source.async_get_media_event_store ( HomeAssistant  hass,
GoogleNestSubscriber   subscriber 
)
Create the disk backed EventMediaStore.

Definition at line 76 of file media_source.py.

◆ async_get_media_source()

MediaSource homeassistant.components.nest.media_source.async_get_media_source ( HomeAssistant  hass)
Set up Nest media source.

Definition at line 253 of file media_source.py.

◆ async_get_media_source_devices()

Mapping[str, Device] homeassistant.components.nest.media_source.async_get_media_source_devices ( HomeAssistant  hass)
Return a mapping of device id to eligible Nest event media devices.

Definition at line 259 of file media_source.py.

◆ async_get_transcoder()

Transcoder homeassistant.components.nest.media_source.async_get_transcoder ( HomeAssistant  hass)
Get a nest clip transcoder.

Definition at line 90 of file media_source.py.

◆ parse_media_id()

MediaId | None homeassistant.components.nest.media_source.parse_media_id ( str | None   identifier = None)
Parse the identifier path string into a MediaId.

Definition at line 289 of file media_source.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.nest.media_source._LOGGER = logging.getLogger(__name__)
private

Definition at line 57 of file media_source.py.

◆ CLIP_TITLE_FORMAT

string homeassistant.components.nest.media_source.CLIP_TITLE_FORMAT = "{event_name} @ {event_time}"

Definition at line 61 of file media_source.py.

◆ DEVICE_TITLE_FORMAT

string homeassistant.components.nest.media_source.DEVICE_TITLE_FORMAT = "{device_name}: Recent Events"

Definition at line 60 of file media_source.py.

◆ DISK_READ_LRU_MAX_SIZE

int homeassistant.components.nest.media_source.DISK_READ_LRU_MAX_SIZE = 32

Definition at line 73 of file media_source.py.

◆ EVENT_MEDIA_API_URL_FORMAT

string homeassistant.components.nest.media_source.EVENT_MEDIA_API_URL_FORMAT = "/api/nest/event_media/{device_id}/{event_token}"

Definition at line 62 of file media_source.py.

◆ EVENT_THUMBNAIL_URL_FORMAT

string homeassistant.components.nest.media_source.EVENT_THUMBNAIL_URL_FORMAT = "/api/nest/event_media/{device_id}/{event_token}/thumbnail"

Definition at line 63 of file media_source.py.

◆ MEDIA_PATH

string homeassistant.components.nest.media_source.MEDIA_PATH = f"{DOMAIN}/event_media"

Definition at line 70 of file media_source.py.

◆ MEDIA_SOURCE_TITLE

string homeassistant.components.nest.media_source.MEDIA_SOURCE_TITLE = "Nest"

Definition at line 59 of file media_source.py.

◆ STORAGE_KEY

string homeassistant.components.nest.media_source.STORAGE_KEY = "nest.event_media"

Definition at line 65 of file media_source.py.

◆ STORAGE_SAVE_DELAY_SECONDS

int homeassistant.components.nest.media_source.STORAGE_SAVE_DELAY_SECONDS = 120

Definition at line 68 of file media_source.py.

◆ STORAGE_VERSION

int homeassistant.components.nest.media_source.STORAGE_VERSION = 1

Definition at line 66 of file media_source.py.