Motion Sensor Trait
API Service: MotionSensorApi
Represents a sensor that detects motion. Note that the absence of motion does not directly imply an unoccupied space.
| Method | Request Type | Response Type | Description |
|---|---|---|---|
| GetMotionDetection | GetMotionDetectionRequest | MotionDetection | Get the current motion state for the device. |
| PullMotionDetections | PullMotionDetectionRequest | PullMotionDetectionResponse stream | subscribe to changes in the motion state for the device. |
Info Service: MotionSensorSensorInfo
Describes the capabilities of a specific named device with respect to this trait.
| Method | Request Type | Response Type | Description |
|---|---|---|---|
| DescribeMotionDetection | DescribeMotionDetectionRequest | MotionDetectionSupport | Get information about how a named device implements MotionDetection measurements |
MotionDetection
the current state of the motion sensor
| Field Name | Type | Description |
|---|---|---|
| state | MotionDetection.State | has motion been detected or not |
| state_change_time | google.protobuf.Timestamp | The time the state last changed |
MotionDetection.State
Possible states for motion detected
| Name | Number | Description |
|---|---|---|
| STATE_UNSPECIFIED | 0 | The state has not been specified. |
| NOT_DETECTED | 1 | No motion is detected, or has been detected within the not_detected_delay period |
| DETECTED | 2 | Motion has been detected by the device. |
MotionDetectionSupport
MotionDetectionSupport describes the capabilities of devices implementing this trait
| Field Name | Type | Description |
|---|---|---|
| resource_support | smartcore.types.ResourceSupport | How a named device supports read/pull apis |
| not_detected_delay | google.protobuf.Duration | How long the device is configured to wait before reporting a state of NOT_DETECTED |
GetMotionDetectionRequest
request to fetch the current state of the device
| Field Name | Type | Description |
|---|---|---|
| name | string | the name for the device to get the detection state for |
| read_mask | google.protobuf.FieldMask | The state fields to fetch |
PullMotionDetectionRequest
request to be notified of changes to the state of the device
| Field Name | Type | Description |
|---|---|---|
| name | string | the name for the device to subscribe to |
| read_mask | google.protobuf.FieldMask | The state fields to fetch |
| updates_only | bool | When true the device will only send changes to the resource value. The default behaviour is to send the current value immediately followed by any updates as they happen. |
PullMotionDetectionResponse
response containing motion state changes
| Field Name | Type | Description |
|---|---|---|
| changes | repeated PullMotionDetectionResponse.Change | the list of changes that have occurred since the last event |
PullMotionDetectionResponse.Change
A change to the motion state of the device
| Field Name | Type | Description |
|---|---|---|
| name | string | name for the device that issued the change |
| change_time | google.protobuf.Timestamp | when the change occurred |
| motion_detection | MotionDetection | the new state for the device |
DescribeMotionDetectionRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device |