Appearance
traits/mode.proto
Table of Contents
traits/mode.proto
DescribeModesRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device |
GetModeValuesRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device to fetch the state for | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the ModeValues type |
ModeValues
ModeValues describes the current value for each available mode on a device.
Field | Type | Label | Description |
---|---|---|---|
values | ModeValues.ValuesEntry | repeated | Values, keyed by the mode name, reports the current mode value name active on the device. For example |
ModeValues.ValuesEntry
Field | Type | Label | Description |
---|---|---|---|
key | string | ||
value | string |
ModeValuesRelative
ModeValuesRelative describes how a mode should change relative to its current value. For example {"temperature": -1} might adjust the "temperature" mode from "warm" to "cool".
Field | Type | Label | Description |
---|---|---|---|
values | ModeValuesRelative.ValuesEntry | repeated |
ModeValuesRelative.ValuesEntry
Field | Type | Label | Description |
---|---|---|---|
key | string | ||
value | int32 |
Modes
Modes describes the modes available on a device.
Field | Type | Label | Description |
---|---|---|---|
modes | Modes.Mode | repeated | Modes holds the list of supported modes for a device. |
Modes.Mode
Mode describes a controllable aspect of the device. For example "spin_speed" or "divisible_state".
Field | Type | Label | Description |
---|---|---|---|
name | string | Name is use to refer to this mode in ModeValues or ModeAdjustments. | |
values | Modes.Value | repeated | Values is the list of available values this mode supports. |
ordered | bool | If true, the values this mode support can be considered ordered. For example ["fast", "normal", "slow"] are ordered, ["joined", "split"] are not. |
Modes.Value
Value describes a specific setting for a mode.
Field | Type | Label | Description |
---|---|---|---|
name | string | Name is used to refer to this value in ModeValues. |
ModesSupport
Field | Type | Label | Description |
---|---|---|---|
mode_values_support | smartcore.types.ResourceSupport | How a named device supports read/write/pull apis for mode values | |
available_modes | Modes | AvailableModes holds the list of modes the device supports. |
PullModeValuesRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device to fetch the state for | |
read_mask | google.protobuf.FieldMask | Fields to fetch relative to the ModeValues type | |
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. |
PullModeValuesResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullModeValuesResponse.Change | repeated | Changes since the last message. |
PullModeValuesResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device that issued the change. | |
change_time | google.protobuf.Timestamp | When the change occurred | |
mode_values | ModeValues | The new value for each mode. |
UpdateModeValuesRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device to fetch the state for | |
mode_values | ModeValues | The new mode values. | |
relative | ModeValuesRelative | Relative changes to the current mode values. If a mode name is specified in both mode_values and relative, and the adjustment in relative is non-zero, relative adjustments win. | |
update_mask | google.protobuf.FieldMask | Fields to update relative to the ModeValues and ModeAdjustments type. |
ModeApi
Trait for devices that present one or more distinct modes. For example a washing machine might have a "temperature" mode with available values ["delicate", "auto", "whites"].
Method Name | Request Type | Response Type | Description |
---|---|---|---|
GetModeValues | GetModeValuesRequest | ModeValues | GetModeValues returns the current state for all modes for a device. |
UpdateModeValues | UpdateModeValuesRequest | ModeValues | UpdateModeValues sets the current mode for the device. Multiple modes may be set at the same time. The device may error if setting a mode that is not supported, in any case the returned ModeValues contains the state after the update. Relative updates to the mode may either cap or wrap the mode value if adjusting the value relatively would either underflow or overflow the available modes. |
PullModeValues | PullModeValuesRequest | PullModeValuesResponse stream | PullModeValues returns a stream of updates to the modes set on the device. |
ModeInfo
Describes the capabilities of a specific named device with respect to this trait.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
DescribeModes | DescribeModesRequest | ModesSupport | Get information about how a named device implements Modes features |