Connect a Lock to Alexa

The following shows an example of how to use the capability interfaces to connect a lock to Alexa.

Capabilities

The lock declares the following capabilities.

Capability Purpose Example utterance

LockController

Allows a customer to lock the device.

"Lock the Front Door"

EndpointHealth

Enables in-depth reporting of the state of the device to the customer through experiences like the Alexa app.

Not applicable.

Alexa

Contains directives and events related to state and error reporting. Make sure to explicitly include this interface and the supported version in the discovery response.

Not applicable.

Discovery

The lock provides the following AddOrUpdateReport.

{
  "event": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "AddOrUpdateReport",
      "payloadVersion": "3",
      "messageId": "00000000-0000-0000-0000-000000000000"
    },
    "payload": {
      "endpoints": [
        {
          "endpointId": "appliance-001",
          "friendlyName": "Front Door",
          "description": "Smart Lock by Sample Manufacturer",
          "manufacturerName": "Sample Manufacturer",
          "displayCategories": [
            "SMARTLOCK"
          ],
          "cookie": {},
          "capabilities": [
            {
              "type": "AlexaInterface",
              "interface": "Alexa.LockController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "lockState"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            }
          ]
        }
      ]
    }
  }
}

For information about building a smart home skill for locks, see Build a Smart Home Skill for Locks.

For more details on state reporting, see Understand State Reporting for a Smart Home Skill.

If the device has additional capabilities, you can add other capability interfaces.