Mode Trait
API Service: 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 | 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. |
Info Service: ModeInfo
Describes the capabilities of a specific named device with respect to this trait.
Method | Request Type | Response Type | Description |
---|---|---|---|
DescribeModes | DescribeModesRequest | ModesSupport | Get information about how a named device implements Modes features |
ModeValues
ModeValues describes the current value for each available mode on a device.
Field Name | Type | Description |
---|---|---|
values | map<string , string > | Values, keyed by the mode name, reports the current mode value name active on the device. For example {"temperature": "cool"} |
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 Name | Type | Description |
---|---|---|
values | map<string , int32 > |
Modes
Modes describes the modes available on a device.
Field Name | Type | Description |
---|---|---|
modes | repeated Modes.Mode | Modes holds the list of supported modes for a device. |
Modes.Value
Value describes a specific setting for a mode.
Field Name | Type | Description |
---|---|---|
name | string | Name is used to refer to this value in ModeValues. |
Modes.Mode
Mode describes a controllable aspect of the device. For example "spin_speed" or "divisible_state".
Field Name | Type | Description |
---|---|---|
name | string | Name is use to refer to this mode in ModeValues or ModeAdjustments. |
values | repeated Modes.Value | 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. |
ModesSupport
Field Name | Type | 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. |
GetModeValuesRequest
Field Name | Type | 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 |
UpdateModeValuesRequest
Field Name | Type | 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. |
PullModeValuesRequest
Field Name | Type | 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 Name | Type | Description |
---|---|---|
changes | repeated PullModeValuesResponse.Change | Changes since the last message. |
PullModeValuesResponse.Change
Field Name | Type | 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. |
DescribeModesRequest
Field Name | Type | Description |
---|---|---|
name | string | The name of the device |