On Off Trait
API Service: OnOffApi
Applicable to devices that have a basic binary on and off functionality.
Method | Request Type | Response Type | Description |
---|---|---|---|
GetOnOff | GetOnOffRequest | OnOff | Get the current state of the device |
UpdateOnOff | UpdateOnOffRequest | OnOff | Update the device to be on or off |
PullOnOff | PullOnOffRequest | PullOnOffResponse stream | Get notified of changes to the OnOff state of a device |
Info Service: OnOffInfo
Describes the capabilities of a specific named device with respect to this trait.
Method | Request Type | Response Type | Description |
---|---|---|---|
DescribeOnOff | DescribeOnOffRequest | OnOffSupport | Get information about how a named device implements OnOff features |
OnOff
Field Name | Type | Description |
---|---|---|
state | OnOff.State |
OnOff.State
Possible states for an On-Off device
Name | Number | Description |
---|---|---|
STATE_UNSPECIFIED | 0 | |
ON | 1 | |
OFF | 2 |
OnOffSupport
OnOffSupport describes the capabilities of devices implementing this trait
Field Name | Type | Description |
---|---|---|
resource_support | smartcore.types.ResourceSupport | How a named device supports read/write/pull apis |
GetOnOffRequest
Field Name | Type | Description |
---|---|---|
name | string | |
read_mask | google.protobuf.FieldMask | The state fields to fetch |
UpdateOnOffRequest
Field Name | Type | Description |
---|---|---|
name | string | |
on_off | OnOff | |
update_mask | google.protobuf.FieldMask | The state fields to update |
PullOnOffRequest
A request to monitor the state of a device
Field Name | Type | 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. |
PullOnOffResponse
Response to a Pull request for OnOffState changes
Field Name | Type | Description |
---|---|---|
changes | repeated PullOnOffResponse.Change | Changes that have occurred since the last event |
PullOnOffResponse.Change
Field Name | Type | Description |
---|---|---|
name | string | |
on_off | OnOff | |
change_time | google.protobuf.Timestamp | when the change occurred |
DescribeOnOffRequest
Field Name | Type | Description |
---|---|---|
name | string | The name of the device |