Gadget ID Requirements for Alexa Gadgets
A gadget ID is a unique string, or serial number, that identifies the gadget. The gadget ID is stored in the gadget firmware and might be etched on the gadget or marked on the packaging. If you reach out to us for support, we will likely ask you for the gadget ID of the gadget you use for development.
Other names for a gadget ID
The gadget ID is also called the following:
- the device serial number (DSN) for the gadget.
- the
endpointId
that the gadget sends the Echo device in theAlexa.Discovery.Discover.Response
event.
The gadget ID is not the same as the endpointId
that the Endpoint Enumeration API returns, that you then use to send a custom directive to a specific gadget from an Alexa skill. This endpointId
you get through the Endpoint Enumeration API is based on the gadget ID, but this endpointId
is an opaque Alexa-generated string that internally maps a gadget ID to a directed endpoint ID. This way, skills can refer to gadgets without getting access to the real gadget ID or being able to infer the real gadget ID.
Gadget ID requirements
The gadget ID has the following requirements:
- It must never change. After a gadget starts communicating with an Echo device, you should never change its gadget ID. Changing a gadget ID can cause connectivity problems.
- It must be unique within a gadget type across all users and skills. In other words, gadgets of the same type must have a unique ID. The gadget type is the gadget's Amazon ID, which you can view in the developer console.
- It must be alphanumeric, and may contain dashes, periods or underscores.
- It must be at least 6 characters.
- It can't exceed 19 characters.
- It must conform to the regex expression
[a-zA-Z0-9][a-zA-Z0-9_.-]{5,18}
- It must be readable by the gadget firmware at runtime, because the gadget uses the DSN to generate the
Alexa.Discovery.Discover.Response
and other gadget event messages.
How to choose a gadget ID
There are multiple ways to choose gadget IDs. For example, you can use a random number that you generate with sufficient entropy, or you can use a database to store all previously generated serial numbers and increment them each time you generate a new ID.
During development, it might be best to generate gadget IDs with a prefix, such as DEV
, followed by the timestamp when the ID was generated.
Examples
The following table shows some example gadget IDs.
Gadget ID | Description |
---|---|
|
ID generated with a |
|
ID generated with a |
|
ID generated based on a coded schema. |
Related topics
- Alexa.Discovery Interface
- Send a Gadget a Custom Directive from a Skill
- Pair and Connect a Gadget to an Echo Device Over Classic Bluetooth
- Pairing and Connection Flow for Alexa Gadgets over Bluetooth Low Energy
Last updated: Feb 14, 2022