Electric Trait
API Service: 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 | 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. |
Info Service: ElectricInfo
Describes the capabilities of a specific named device with respect to this trait.
No methods defined for this service.
ElectricDemand
ElectricDemand describes how much power is being used by the device.
Field Name | Type | Description |
---|---|---|
current | float | A measure of how much electric current is currently being used. In amps. |
voltage | float | 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 | The power factor of the device. Use this to convert VA (apparent power) to W (real power). |
real_power | float | 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 | 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 | 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 Name | Type | 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 | repeated ElectricMode.Segment | 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 Name | Type | 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. |
GetDemandRequest
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 ElectricDemand type |
PullDemandRequest
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 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 Name | Type | Description |
---|---|---|
changes | repeated PullDemandResponse.Change | Changes since the last message. |
PullDemandResponse.Change
Field Name | Type | 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. |
GetActiveModeRequest
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 ElectricMode type |
UpdateActiveModeRequest
Field Name | Type | 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. |
ClearActiveModeRequest
Field Name | Type | Description |
---|---|---|
name | string | Name of the device |
PullActiveModeRequest
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 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 Name | Type | Description |
---|---|---|
changes | repeated PullActiveModeResponse.Change | Changes since the last message |
PullActiveModeResponse.Change
Field Name | Type | 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 |
ListModesRequest
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 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 Name | Type | Description |
---|---|---|
modes | repeated ElectricMode | |
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. |
PullModesRequest
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 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 Name | Type | Description |
---|---|---|
changes | repeated PullModesResponse.Change | The list of changes which have occurred |
PullModesResponse.Change
Field Name | Type | 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 |