Occupancy Sensor Trait
API Service: OccupancySensorApi
The reporting of occupancy in a space. Similar to a MotionSensor, this reports whether a space is occupied or unoccupied with additional optional information relating to how occupied the space is (i.e. how many people are present)
| Method | Request Type | Response Type | Description |
|---|---|---|---|
| GetOccupancy | GetOccupancyRequest | Occupancy | Get the current motion state for the device. |
| PullOccupancy | PullOccupancyRequest | PullOccupancyResponse stream | subscribe to changes in the motion state for the device. |
Info Service: OccupancySensorInfo
Describes the capabilities of a specific named device with respect to this trait.
| Method | Request Type | Response Type | Description |
|---|---|---|---|
| DescribeOccupancy | DescribeOccupancyRequest | OccupancySupport | Get information about how a named device implements Occupancy measurements |
Occupancy
The occupancy state the device is reporting and updating
| Field Name | Type | Description |
|---|---|---|
| state | Occupancy.State | The current occupancy state |
| people_count | int32 | The total number of people the occupancy sensor has detected. Do NOT use this value as an indication of occupancy state, a value of 0 could be reported for a space that is occupied if the device either doesn't support people counts or there is some other undefined issue with the counting part of the sensor suite. |
| state_change_time | google.protobuf.Timestamp | When the occupancy state last changed. Does not update when people_count changes unlike the timestamp in OccupancyChange events |
| reasons | repeated string | Optional. List of human readable strings explaining why the device thinks the space is in the current state. For example could say OCCUPIED:["Detected people in space"] or IDLE:["No motion detected for 10 minutes"]. Typically used for debugging or troubleshooting purposes. |
| confidence | double | Optional. How confident is the sensor that the current occupancy state is accurate. A value of 0 means that the confidence is unknown |
Occupancy.State
Possible states for occupancy
| Name | Number | Description |
|---|---|---|
| STATE_UNSPECIFIED | 0 | There are no signals to suggest either an occupied or unoccupied space |
| OCCUPIED | 1 | The space is occupied |
| UNOCCUPIED | 2 | The space is unoccupied |
| IDLE | 3 | The space is likely occupied but some signals suggest that no activity is occurring (i.e. people are asleep or not moving for other reasons) |
OccupancySupport
OccupancySupport 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 |
| max_people | int32 | how many people can the occupancy service report. 0 means it won't report people counts. Note: this is not the total capacity for the space, it's the capacity of the sensor |
GetOccupancyRequest
request to fetch the current state of the device
| Field Name | Type | Description |
|---|---|---|
| name | string | the name for the device to get the occupancy state for |
| read_mask | google.protobuf.FieldMask | The state fields to fetch |
PullOccupancyRequest
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. |
PullOccupancyResponse
response containing occupancy state changes
| Field Name | Type | Description |
|---|---|---|
| changes | repeated PullOccupancyResponse.Change | the list of changes that have occurred since the last event |
PullOccupancyResponse.Change
A change to the occupancy state of the device, including people count
| Field Name | Type | Description |
|---|---|---|
| name | string | name for the device that issued the change |
| change_time | google.protobuf.Timestamp | when the change occurred |
| occupancy | Occupancy | the new state for the device |
DescribeOccupancyRequest
| Field Name | Type | Description |
|---|---|---|
| name | string | The name of the device |