Camera with Floodlight

Nest Floodlight

The Google Nest Cam with floodlight is supported in the Smart Device Management (SDM) API. This device returns a device type of CAMERA:

sdm.devices.types.CAMERA

Traits

Reference

The following traits, commands, or events are related to this device:

TraitDescriptionCommandsEvents
CameraLiveStreamThis trait belongs to any device that supports live streaming.GenerateWebRtcStream
ExtendWebRtcStream
StopWebRtcStream
CameraMotionThis trait belongs to any device that supports motion detection events.Motion
CameraPersonThis trait belongs to any device that supports person detection events.Person
InfoThis trait belongs to any device for device-related information.

JSON

The absence of a trait in a GET response indicates that the trait or feature is not currently available for the device. See Device types for more information.

{
  "type" : "sdm.devices.types.CAMERA",
  "traits" : {
    "sdm.devices.traits.CameraLiveStream" : {
      "maxVideoResolution" : {
        "width" : 640,
        "height" : 480
      },
      "videoCodecs" : ["H264"],
      "audioCodecs" : ["AAC"],
      "supportedProtocols" : ["WEB_RTC"]
    },
    "sdm.devices.traits.CameraMotion" : {},
    "sdm.devices.traits.CameraPerson" : {},
    "sdm.devices.traits.Info" : {
      "customName" : "My device"
    }
  }
}

Handle camera events

The following events may be triggered from a CAMERA device type or a DOORBELL or DISPLAY that features a camera, such as the Google Nest Doorbell (wired) or Google Nest Hub Max :

Type Element Description
Event Motion event of the CameraMotion trait Motion has been detected by the camera.
Event Person event of the CameraPerson trait A person has been detected by the camera.
For example, here the camera has detected motion:

Payload

{
  "eventId" : "236be3cb-a87e-47f4-b6cc-bd85576f763e",
"timestamp" : "2019-01-01T00:00:01Z",
"resourceUpdate" : { "name" : "enterprises/project-id/devices/device-id", "events" : { "sdm.devices.events.CameraMotion.Motion" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "eventId" : "NBdu1PiIB6sy4TY1l66i4_uvUP...", } } } "userId" : "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi",
"resourceGroup" : [ "enterprises/project-id/devices/device-id" ] }

Access a live stream

The live stream from a camera can be accessed. The following stream formats are supported for this device:

  • WebRTC

For a full list of cameras and supported stream formats, see Supported Devices.

To access a live stream, use the appropriate GenerateFormatStream command of the CameraLiveStream trait.

WebRTC


For a WebRTC stream, send an offerSdp in the GenerateWebRtcStream command of the CameraLiveStream trait to get an answerSdp:

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.GenerateWebRtcStream",
  "params" : {
    "offerSdp" : "offerSdp"
  }
}

Response

{
  "results" : {
    "answerSdp" : "answerSdp",
    "expiresAt" : "2020-01-04T18:30:00.000Z",
    "mediaSessionId" : "wB0itfpTVLS6641vPoRIATVvfj..."
  }
}

Required: The audio setting in the offerSdp for this command must be set to a=recvonly (receive only).

The answerSdp must be used to generate the live stream within 30 seconds of receiving the response, otherwise it expires. If it expires, execute the GenerateWebRtcStream command again to receive a new answerSdp.

When opening WebRTC channels for the live stream, make sure to create a data channel as well as a video channel.

Extend a live stream

Camera live stream sessions are only valid for 5 minutes. If you need to extend the lifetime of a live stream, use the appropriate ExtendFormatStream command of the CameraLiveStream trait for the stream format you generated.

WebRTC


A WebRTC stream can only be extended on wire-powered cameras. A camera is considered wire-powered while plugged in for charging. If the camera is on battery power, a request to extend an active WebRTC stream will be ignored.

To extend a WebRTC stream, specify the media session ID of the stream with the ExtendWebRtcStream command of the CameraLiveStream trait:

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.ExtendWebRtcStream",
  "params" : {
    "mediaSessionId" : "wB0itfpTVLS6641vPoRIATVvfj..."
  }
}

Response

{
  "results" : {
    "expiresAt" : "2018-01-04T18:30:00.000Z",
    "mediaSessionId" : "wB0itfpTVLS6641vPoRIATVvfj..."
  }
}

Stop a live stream

Any time you are no longer using a camera live stream, you should stop it and invalidate the stream. To do so, use the appropriate StopFormatStream command of the CameraLiveStream trait for the stream format you generated.

WebRTC


To stop a WebRTC stream, specify the media session ID with the StopWebRtcStream command of the CameraLiveStream trait:

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.StopWebRtcStream",
  "params" : {
    "mediaSessionId" : "wB0itfpTVLS6641vPoRIATVvfj..."
  }
}

Response

{}

Errors

See the API Error Code Reference for the full list of API error codes.