Appearance
traits/electric.proto
Table of Contents
traits/electric.proto
ClearActiveModeRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device |
ElectricDemand
ElectricDemand describes how much power is being used by the device.
Field | Type | Label | Description |
---|---|---|---|
current | float | A measure of how much electric current is currently being used. In amps. | |
voltage | float | optional | The voltage level of the device. In volts. |
rating | float | The maximum current that the device can handle under normal operation. In amps. Zero means absent, not 0 amps. | |
power_factor | float | optional | The power factor of the device. Use this to convert VA (apparent power) to W (real power). |
real_power | float | optional | The real power of the device. In watts. The product of current * voltage * power_factor, though might be different depending on measured values. |
apparent_power | float | optional | The apparent power of the device. In volt-amps. The product of current * voltage, though might be different depending on measured values. |
reactive_power | float | optional | The reactive power of the device. In volt-amps reactive. |
ElectricMode
An ElectricMode represents one possible electrical mode of operation for the device. A device can potentially have multiple electrical modes, for example a TV might have Normal and Eco modes. The electric mode of the device gives details on how the device expects its electricity usage to be affected when in these modes.
Field | Type | Label | Description |
---|---|---|---|
id | string | ID uniquely identifies this mode in a device. | |
title | string | A human readable name for this mode. Output only. Examples might include "Eco Mode", or "Smart Standby" | |
description | string | A human readable description for this mode. | |
voltage | float | The voltage level of this mode. In volts. Zero means absent, not 0 volts. | |
start_time | google.protobuf.Timestamp | The time the modes information is relative to in server time. When a client receives a mode with an absent start time it should use its own clock to create one, though this may introduce skew depending on the difference between the server and client clocks. | |
segments | ElectricMode.Segment | repeated | An ordered, continuous, non-empty, list of segments representing the power draw for this mode. The first segment is relative to start_time, the second is relevant to the end of the first and so on. |
normal | bool | When true this indicates that this mode is the normal / default operation mode for the device. A device should have only one default mode. |
ElectricMode.Segment
A Segment describes electrical properties for a slice of time.
Field | Type | Label | Description |
---|---|---|---|
length | google.protobuf.Duration | The length of this mode segment. An absent length means this segment lasts forever. Only the last segment of a mode can have an absent length. | |
magnitude | float | The maximum current that will be drawn by the device in this segment. In amps. Required. See the shape properties to determine a more accurate shape for the electrical demand. | |
fixed | float | Fixed represents a constant consumption for the length of this segment. In amps. |
GetActiveModeRequest
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 ElectricMode type |
GetDemandRequest
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 ElectricDemand type |
ListModesRequest
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 ElectricMode type | |
page_size | int32 | The maximum number of modes to return. The service may return fewer than this value. If unspecified, at most 50 items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. | |
page_token | string | A page token, received from a previous ListModesResponse call. Provide this to retrieve the subsequent page. |
ListModesResponse
Field | Type | Label | Description |
---|---|---|---|
modes | ElectricMode | repeated | |
next_page_token | string | A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. | |
total_size | int32 | If non-zero this is the total number of draw notifications. This may be an estimate. |
PullActiveModeRequest
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 ElectricMode 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. |
PullActiveModeResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullActiveModeResponse.Change | repeated | Changes since the last message |
PullActiveModeResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | Name for the device that issued the change | |
change_time | google.protobuf.Timestamp | When the change occurred | |
active_mode | ElectricMode | The new value for the active mode |
PullDemandRequest
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 ElectricDemand 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. |
PullDemandResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullDemandResponse.Change | repeated | Changes since the last message. |
PullDemandResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device that issued the change. | |
change_time | google.protobuf.Timestamp | When the change occurred | |
demand | ElectricDemand | The new value for the current demand. |
PullModesRequest
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 ElectricMode 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. |
PullModesResponse
Field | Type | Label | Description |
---|---|---|---|
changes | PullModesResponse.Change | repeated | The list of changes which have occurred |
PullModesResponse.Change
Field | Type | Label | Description |
---|---|---|---|
name | string | The name of the device that emitted this change | |
type | smartcore.types.ChangeType | The type of change (e.g. ADD, UPDATE, etc...) | |
new_value | ElectricMode | The new value to use for ADD | |
old_value | ElectricMode | The old value to use for UPDATE | |
change_time | google.protobuf.Timestamp | When the change occurred |
UpdateActiveModeRequest
Field | Type | Label | Description |
---|---|---|---|
name | string | Name of the device | |
active_mode | ElectricMode | The active mode to select. The id field should be specified to select an existing mode. | |
update_mask | google.protobuf.FieldMask | Fields to update relative to the ElectricMode type. |
ElectricApi
Trait for devices that are electrically powered. Can apply to both the end device or an intermediary, for example a TV or an extension cord.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
GetDemand | GetDemandRequest | ElectricDemand | GetDemand returns the current electricity demand for the device. |
PullDemand | PullDemandRequest | PullDemandResponse stream | PullDemand returns a stream of changes to the current electricity demand for the device. |
GetActiveMode | GetActiveModeRequest | ElectricMode | |
UpdateActiveMode | UpdateActiveModeRequest | ElectricMode | Configure the device to use the given mode. The id of the given mode should match a known mode for the device. |
ClearActiveMode | ClearActiveModeRequest | ElectricMode | ClearActiveMode instructs the device to discard any external mode selection, typically by applying the normal operation mode for the device. |
PullActiveMode | PullActiveModeRequest | PullActiveModeResponse stream | |
ListModes | ListModesRequest | ListModesResponse | ListModes lists all electric modes for a device |
PullModes | PullModesRequest | PullModesResponse stream | PullModes returns a stream of changes to the list of supported modes for the device. |
ElectricInfo
Describes the capabilities of a specific named device with respect to this trait.
todo: ElectricInfo service
Method Name | Request Type | Response Type | Description |
---|