Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get started
Connect with Matter
Alexa Connect Kit
Add-ons
Certify
Resources
Skip to main content
Implement the Alexa.DeviceUsage.Meter interface in your Alexa add-on so that customers can view their energy use. Use the Alexa.DeviceUsage.Meter interface with your devices that measure energy use, such as electric and natural gas meters. The Alexa.DeviceUsage.Meter interface is intended to help customers manage their energy usage with the Alexa energy dashboard. For details, see Smart Home Energy Overview. If your device doesn’t measure energy consumption directly, such as a thermostat, use the Alexa.DeviceUsage.Estimation interface instead. Unlike other interfaces, proactive reporting isn’t optional. When you support the Alexa.DeviceUsage.Meter interface, you must send proactive events to the Alexa event gateway. You are required to send MeasurementsReport events. For the list of locales that the Alexa.DeviceUsage.Meter interface supports, see List of Alexa Interfaces and Supported Languages. For the definitions of the message properties, see Alexa Interface Message and Property Reference.

Utterances

The Alexa.DeviceUsage.Meter interface doesn’t have any user utterances. Instead, you send energy usage events to Alexa, so that Alexa can report energy use to the customer.

Data measurement resolution

You set a default resolution, in seconds, for how often you report data measurements of energy use. Amazon recommends a minimum resolution of 3,600 (hourly) and a maximum resolution of 86,400 (daily). The resolution you specify determines how the data appears to the user. Alexa doesn’t assume a constant rate of energy use between data points, and doesn’t imply that to the user. Unless there is an extended period of zero energy use, your data reporting shouldn’t fall below your default resolution. If you report data more frequently than hourly, your data isn’t all recorded. If you report data less frequently than daily, useful data doesn’t appear to the user.

Reportable properties

The Alexa.DeviceUsage.Meter interface doesn’t have any reportable properties.

Discovery

You describe endpoints that support Alexa.DeviceUsage.Meter using the standard discovery mechanism described in Alexa.Discovery. For the full list of display categories, see display categories.

Configurations object

In addition to the usual discovery response fields, for Alexa.DeviceUsage.Meter, include a configurations object that contains an energySources object that contains an electricity object, a naturalGas object, or both. The electricity object and the naturalGas object each contain the following fields.
FieldDescriptionType
unitThe unit of measure for the energy source. One of MILLIWATT_HOUR, BTU, CUBIC_FOOT.String
measuringMethodThe method you use to measure energy use. MEASURED if your device has dedicated hardware to physically measure energy use; otherwise, ESTIMATED.String
defaultResolutionThe resolution of your data readings, in seconds. Amazon recommends a minimum resolution of 3,600 (hourly) and a maximum resolution of 86,400 (daily). For details, see data measurement resolution.Number

Discover response example

The following example shows a Discover.Response message for a meter that supports the Alexa.DeviceUsage.Meter interface.

Directives and events

The Alexa.DeviceUsage.Meter interface defines the following directives and events.

ReportMeasurements directive

Support the ReportMeasurements directive so that Alexa can request data from you. The payload of the ReportMeasurements directive is empty.

ReportMeasurements directive example

The following example illustrates a ReportMeasurements directive that Alexa sends to your add-on.

ReportMeasurements response

If you handle a ReportMeasurements directive successfully, first respond with an Alexa.Response event. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token and a scope with an authorization token. The payload for the response is empty. After you send your Response event, send a MeasurementsReport event to report your data to Alexa. The following example shows a ReportMeasurements response.

ReportMeasurements directive error handling

If you can’t handle a ReportMeasurements directive successfully, respond with an Alexa.ErrorResponse event.

ReduceResolution directive

Support the ReduceResolution directive so that Alexa can notify you when you are sending messages to the Alexa event gateway too frequently.

ReduceResolution directive example

The following example illustrates a ReduceResolution directive that Alexa sends to your add-on.

ReduceResolution directive payload

FieldDescriptionType
limitThe upper bound for the resolution of the data you report to Alexa, in seconds. This limit overrides the defaultResolution that you report in your discovery response. If you continue to report data at a higher resolution, you might encounter throttling exceptions, and some data points might be dropped.Number
durationReduce the resolution for this amount of time. The time period is represented in ISO 8601 duration format. If the duration field isn’t present, reduce the resolution until you receive a new ReduceResolution directive.String

ReduceResolution response

If you handle a ReduceResolution directive successfully, respond with an Alexa.Response event. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token and a scope with an authorization token. The payload for the response is empty. The following example shows a ReduceResolution response.

ReduceResolution directive error handling

If you can’t handle a ReduceResolution directive successfully, respond with an Alexa.ErrorResponse event.

InvalidMeasurementError directive

Support the InvalidMeasurementError directive so that Alexa can notify you when you have sent an invalid data point.

InvalidMeasurementError directive example

The following example illustrates a InvalidMeasurementError directive that Alexa sends to your add-on.

InvalidMeasurementError directive payload

The payload contains a field named electricity or naturalGas. The field is an object that contains the following fields.
FieldDescriptionType
errorCodeThe error code for the invalid data, such as NEGATIVE_VALUE. For the full list of error codes, see error codes.String
timeOfErrorend timestamp of the data that you sent.
Defined in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ
String

InvalidMeasurementError response

If you handle a InvalidMeasurementError directive successfully, respond with an Alexa.Response event. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token and a scope with an authorization token. The payload for the response is empty. The following example shows an InvalidMeasurementError response.

InvalidMeasurementError directive error handling

If you can’t handle a InvalidMeasurementError directive successfully, respond with an Alexa.ErrorResponse event.

MeasurementsReport event

Send a MeasurementsReport event to the Alexa event gateway to proactively report a batch of one or more energy use measurements to Alexa. Send MeasurementsReport events to the Alexa event gateway at times that are uniformly distributed throughout the day, to the second, for all events generated by your add-on for all customers. For example, you can add a random wait time to each event before sending it. You can send batches of data based on the size and age of the data, instead of the time of day.

MeasurementsReport event example

MeasurementsReport event payload

You must include at least one of the following fields in the payload:
  • electricityIntervals
  • naturalGasIntervals
The following table shows the payload details for the DIR directive.
PropertyDescriptionTypeRequired
electricityIntervalsAmount of electricity used over a period of time.
You must include at least one of electricityIntervals or naturalGasIntervals.
Array of objectsNo
electricityIntervals[].usageAmount of energy used between the start and end interval.NumberYes
electricityIntervals[].startStart time of the interval.
Defined in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ
StringYes
electricityIntervals[].endEnd time of the interval.
Defined in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ
StringYes
naturalGasIntervalsAmount of natural gas used over a period of time.
You must include at least one of electricityIntervals or naturalGasIntervals.
Array of objectsNo
naturalGasIntervals[].usageAmount of energy used between the start and end interval.NumberYes
naturalGasIntervals[].startStart time of the interval.
Defined in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ
StringYes
naturalGasIntervals[].endEnd time of the interval.
Defined in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ
StringYes

AddOrUpdateReport

You must proactively send an Alexa.Discovery.AddOrUpdateReport message if the feature support of your endpoint changes. For example, if you change your default reporting schedule from hourly to daily you must send an AddOrUpdateReport message. For details, see AddOrUpdateReport event.

AddOrUpdateReport event example

Troubleshooting

Error codes

The following are the error codes that Alexa sends in the InvalidMeasurementError directive.
Error CodeDescription
NEGATIVE_VALUEYou reported a negative value for energy usage.
IN_FUTUREYou reported a value with a timestamp in the future. Any data reported with a timestamp that’s more than a few seconds in the future is rejected. A few seconds is considered a minor clock inaccuracy.
INVALID_INTERVAL_START_ENDYou reported an interval that starts after it ends.
INTERVAL_OVERLAPYou reported an interval that overlaps with an interval that you reported previously.

Other possible issues

Alexa sends an InvalidMeasurementError directive that contains an error code if you send invalid data. If you send messages to the Alexa Gateway too frequently, Alexa sends you a ReduceResolution directive. In addition, if you notice unexpected behavior, consider the following issues:
  • Avoid sending duplicate data to the Alexa Event Gateway.
  • Alexa expects your data to be as current as possible. Don’t send data that’s more than one day old.
  • It’s important for timestamps to be accurate. Synchronize with Coordinated Universal Time (UTC) regularly.
  • Intervals shouldn’t be longer than the defaultResolution you sent in your discovery response.
  • In case the device resets unexpectedly, gaps between intervals can occur.
  • Send batched updates in chronological order.
Last modified on August 23, 2024