Alexa.ReportState directive to query your add-on for the current state of all retrievable properties of an interface. You respond with an Alexa.StateReport. In this example, the Alexa.ReportState directive includes the endpoint ID of the light.
For details about state reporting, see Understand State and Change Reporting.
For the definitions of the message properties, see Alexa Interface Message and Property Reference.
Discovery
During discovery, you identify the interfaces that your add-on supports and the retrievable properties of each interface. When you setretrievable = true for an interface, Alexa can query your add-on for the current state of the properties of that interface.
Discovery response example
The following example shows aDiscover.Response message for an Alexa add-on that controls a light and supports the Alexa.PowerController, Alexa.BrightnessController, and Alexa.EndpointHealth interfaces. The powerState, brightness, and connectivity properties are retrievable.
Directives
ReportState directive
When Alexa sends anAlexa.ReportState directive to request the state of an endpoint, you send an Alexa.StateReport response. This response contains the current state of all the properties that are retrievable for the endpoint.
ReportState directive example
The following example shows anAlexa.ReportState directive that Alexa sends to your add-on. The endpointId identifies the device.
StateReport response
If your add-on handles the request successfully, you send theAlexa.StateReport response synchronously from your add-on. Include the correlationToken set to the value from the Alexa.ReportState request. Report the state of all the retrievable properties in the context object and set the payload to an empty object.
To let Alexa know the health of your device, include Alexa.EndpointHealth in your response.
StateReport response example
The following example shows the states of all retrievable properties.StateReport response properties
| Property | Description | Type | Required |
|---|---|---|---|
event | Identifies the endpoint for the report. Include an empty payload object. | Event object | Yes |
context | Report the state of all the retrievable properties. | Context object | Yes |
ReportState directive error handling
If you can’t handle anAlexa.ReportState directive successfully, respond with an Alexa.ErrorResponse event. If you can’t report the state of all the properties because the endpoint is unreachable and you haven’t cached the values, send an Alexa.ErrorResponse of type BRIDGE_UNREACHABLE or ENDPOINT_UNREACHABLE.

