Gracias por tu visita. Esta página solo está disponible en inglés.

DRS - Test your skill

Step 1. Testing device discovery

Testing your Lambda function

You may now perform a quick test of the Discovery request in the Lambda code editor.

  1. Click on Test. The Configure test event page appears.
  2. Leave Create new test event selected. For Event template, leave the default Hello World. In the Event name, enter discovery and replace the entire contents in the editor with the following code.
{
    "directive": {
        "header": {
            "namespace": "Alexa.Discovery",
            "name": "Discover",
            "payloadVersion": "3",
            "messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
        },
        "payload": {
            "scope": {
                "type": "BearerToken",
                "token": "access-token-from-skill"
            }
        }
    }
}
  1. Click Create, and then Test. If successful, the Execution Result should be similar to the following:
{
  "event": {
    "header": {
      "correlationToken": "12345692749237492",
      "messageId": "1bd5d003-31b9-476f-ad03-71d471922820",
      "name": "Discover.Response",
      "namespace": "Alexa.Discovery",
      "payloadVersion": "3"
    },
    "payload": {
      "endpoints": [{
          "endpointId": "appliance-001",
          "friendlyName": "Printer",
          "description": "Printer by Sample Manufacturer",
          "manufacturerName": "Sample Manufacturer",
          "displayCategories": [
            "OTHER"
          ],
          "cookie": {},
          "capabilities": [
            {
              "type": "AlexaInterface",
              "interface": "Alexa.InventoryLevelSensor",
              "version": "3",
              "instance": "InventoryLevelSensor-1",
              "properties": {
                "supported": [{
                  "name": "level"
                }],
                "proactivelyReported": true,
                "retrievable": true
              },
                // Other Capabilities here
            }
          ]
        }]
    }
  }
}

Testing on a physical device

When your implementation is completed, and you have tested your Lambda function, you can functionally test your smart home skill to ensure device discovery is working as expected.

  1. Make sure you have a smart home trigger added and enabled. To check this, go to the Lambda console, select your smart home skill, and make sure you have an Alexa Smart Home trigger. If you don't, go back to the Step 5 of Creating the Lambda Function
  2. Sign in to the Alexa app (available on Android, iOS or the web (Opens in a new tab) with the same credentials as your developer account.
  3. Find your skill in the Alexa app. To do this, go to Skills, and tap Your Skills in the upper right corner of the All Skills page. Scroll to DEV SKILLS and find your skill.
  4. Click the ENABLE button to enable the skill, and you will be directed to account-link the skill to a device cloud account. If you are unable to complete account linking, make sure you are using valid credentials for the device cloud. Otherwise, it is likely there is an issue with account-linking information you provided in the developer console. For help with this, see Alexa: Debugging account linking in the developer forums. If you want to remove account linking later, you should disable your skill in the Skills tab.
  5. Close the window and tap the DISCOVER DEVICES button in the Alexa app.
  6. If the skill does not discover devices, check the logs for your Lambda function to see if it received a discover directive from Alexa, and use the logs to troubleshoot the issue. Common issues include incorrectly formatted event responses.
  7. If your skill successfully discovers devices, return to the Test page of the developer console. You may test other functionalities of the skill (if any).

Step 2. Testing the end-to-end functionality

Execute the certification test cases

  1. Set up a physical device through Alexa – Using the instructions above, open the Alexa app and complete the DRS set-up upon device discovery. You may choose either the "Notify Only" or "Replenish" option when selecting the notification and reorder options.
  2. Trigger a low inventory level – For each slot (replenishmentId), use the product so that the consumable level drops 20% below the initial level
  3. Reset the inventory level - For each slot (replenishmentId), replace the consumable (i.e. replace the battery or ink cartridge) of the product and leave the device running until at least one ChangeReport with a new inventory value is sent to Alexa

Next steps

Once you are satisfied that the skill is performing the two main DRS functionalities (Discovery and Inventory updates) you may submit it for Certification. Please liaise with your account manager to start this process who will reach out within 1-5 business days with the certification status and next steps.

You will need to provide the following information to your Amazon point of contact to initiate certification:

  • 3P Skill ID (for ASK)
  • Model ID (as shown in DRS developer console of specific product)
  • Vendor Code
  • Encrypted Customer ID for customer used when running test cases indicated above
  • Endpoint ID of device used for testing