View Device State to Test and Debug your Smart Home Skill

You can use the Smart Home Devices page of the Alexa developer console to view device state to test and debug your Smart Home skill. You can view the current values of all properties of Smart Home devices that are associated with your skill and your developer account. For details about other test tools, see Test and Debug Your Smart Home Skill.

You report the value of device properties to Alexa in multiple ways, including the following:

  • Alexa sends a ReportState directive to your skill to request information about the state of a device. You send back a StateReport event that contains property values.
  • Your skill proactively reports the state of a device to Alexa by sending a ChangeReport event that contains property values.
  • Alexa sends a directive to your skill. You send back a response event or an error response event that contains property values.

You identify the properties that Alexa can request from you, and those that you proactively report to Alexa, in your discovery response. For details about state reporting, see Understand State and Change Reporting.

View device state

The Smart Home Devices page lists each device associated with the account that you specify when you log into the console. If there are no devices associated with your account, you can add them in the Alexa app.

The following image shows the Smart Home Devices page in the Alexa developer console:

The Smart Home Devices page in the Alexa developer console

To view device state

  1. Sign in to the Alexa developer console.
  2. To view the Smart Home State Reporter tool, open Smart Home Devices.
    Or, on the developer console home page, scroll down to the Resources pane, and then, in the Tools section, click Smart Home State Reporter.
  3. On Smart Home Devices, for each device, the console displays the following data:

    • Type — The type of the device.
    • Skill Name — The skill to which the device links.
    • Namespace — An Alexa interface that the skill implements.
    • Name — The name of a property of the interface.
    • Value — The current value of the property, as known to Alexa.
    • Time of Sample — The timestamp of the property value.
    • Uncertainty in Milliseconds — The uncertainty of the property value, in milliseconds.
    • Deep Query — True, if Alexa obtained the property value from your skill in a StateReport.
      False, if Alexa didn't received a StateReport from your skill. When false, Alexa obtained the property value from your skill in a ChangeReport event, directive response event, or other event.

  4. To expand all rows, collapse all rows, and to download a file that contains the data, click Choose action, and then select the appropriate action.

Query device state

To query device state in the Alexa developer console, use the following procedure.

To query device state

  • Check Force deep queries if you want Alexa to send new ReportState requests to your skill now, instead of using the current cached property values.
  • Click Query all at the top of the page to query the current state of all devices. The data for the entire page refreshes.
  • Click Query at the right side of a row to query the current state of a single device. The data for that device refreshes.

Troubleshoot change reporting problems

If you implement change reporting in your skill, but you don't see the property values that you expect to see, or you see true in the Deep Query column when you expect to see false, use the following troubleshooting information:

  • If you're working with a newly-discovered device, the state cache that Alexa keeps might be empty. Send a ChangeReport to populate the cache.

  • In your discovery response, set proactivelyReported to true for the relevant properties, and verify that you report the relevant properties in your ChangeReport event code.

  • If you implement the EndpointHealth interface, include the connectivity property in your StateReport and ChangeReport events.

  • Only report properties defined by the interfaces that you implement. Don't report directive payload fields unless they're also properties of the interface. For example, the Cooking.FoodTemperatureController interface's CookByFoodTemperature directive sends the fields targetFoodTemperature, cookingMode, and foodItem, but only targetFoodTemperature is a property of that interface. For details, see the documentation for each interface that your skill implements.

  • If your skill implements the ThermostatController interface, cycle through the thermostat modes that your device supports so that Alexa can cache the data.

Test additional scenarios

The following are examples of some additional scenarios that you can test:

  • Change your device state without using Alexa. For example, use another app or the physical device controls to change the device settings. Your skill should send one or more ChangeReport events to Alexa. Confirm that the correct property values appear in the console.

  • If you implement the EndpointHealth interface, verify that you're reporting the connectivity property correctly in the ChangeReport. Turn off the power to your device and wait for the device's health polling or heartbeat interval to pass. Confirm that the correct value appears in the console. Restore power to the device and check the property value again.

  • Verify that you send ChangeReport events for all Amazon accounts that have enabled and account-linked your skill, not just the first, or most recent accounts. Commonly, customers in the same household share Smart Home devices, but have their own Amazon accounts associated with the skills for those devices. To test this scenario, enable and account-link the skill from different Amazon accounts by using the same device credentials. Then change the state of the device without using Alexa.