Appearance
traits/count.proto
Table of Contents
traits/count.proto
Count
Count represents how many of a thing exist. The total measured count is added - removed. Some devices may adjust added up and down and leave removed at 0, some might increase both properties.
Field | Type | Label | Description |
---|---|---|---|
added | int32 | Total number of added items | |
removed | int32 | Total number of removed items | |
reset_time | google.protobuf.Timestamp | The time the counts were reset |
CountSupport
CountSupport describes the capabilities of devices implementing this trait
Field | Type | Label | Description |
---|---|---|---|
resource_support | smartcore.types.ResourceSupport | How a named device supports read/write/pull apis | |
two_way | bool | Two way counters count additions and removals separately. Do NOT use this as a way to ignore the Count.removed property, the total count is always added - removed. | |
supports_reset | bool | Does the api support resetting the count timer. | |
supports_delta | bool | When updating the count does this device support the delta property |
DescribeCountRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device |
GetCountRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | ||
read_mask | google.protobuf.FieldMask | The state fields to fetch |
PullCountsRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | ||
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. |
PullCountsResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullCountsResponse.Change | repeated |
PullCountsResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | ||
count | Count | ||
change_time | google.protobuf.Timestamp | when the change occurred |
ResetCountRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | ||
reset_time | google.protobuf.Timestamp | if absent then the server timestamp will be used |
UpdateCountRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | ||
count | Count | ||
update_mask | google.protobuf.FieldMask | ||
delta | bool | if true the added and removed properties of count should be treated as a change not an absolute value. |
CountApi
CountApi tracks both a positive and negative count of some quantity. Can be used for tickers, footfall sensors, and devices like that.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
GetCount | GetCountRequest | Count | Get the current count state |
ResetCount | ResetCountRequest | Count | Reset the counts to 0 and update the reset time. |
UpdateCount | UpdateCountRequest | Count | Update one or more properties of the count. |
PullCounts | PullCountsRequest | PullCountsResponse stream | Subscribe to changes to the count. |
CountInfo
Describes the capabilities of a specific named device with respect to this trait.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
DescribeCount | DescribeCountRequest | CountSupport | Get information about how a named device implements Count features |