Alexa.Cooking Interface
Implement the Alexa.Cooking
interface in your Alexa skill so that users can control cooking appliances. All cooking appliances must implement the Cooking
interface. For more details about cooking skills, see Build Smart Home Skills for Cooking Appliances.
For the list of languages that the Cooking
interface supports, see List of Alexa Interfaces and Supported Languages.
Utterances
When you use the Alexa.Cooking
interface, the voice interaction model is already built for you. The following examples show some customer utterances:
Alexa, is the oven on?
Alexa, is the microwave running?
Alexa, stop the microwave.
Alexa, turn off the oven.
Alexa, set the oven to convection bake.
Alexa, defrost three pounds of meat in my microwave.
After the customer says one of these utterances, Alexa sends a corresponding directive or report state request to your skill.
Properties
The Alexa.Cooking
interface uses the following properties.
Property | Description | Type |
---|---|---|
cookingMode |
The cooking mode for a cooking session, such as REHEAT . |
A cookingMode. |
foodItem |
The food to cook. | A foodItem. |
cookingTimeInterval |
The time when cooking begins, and when it's expected to complete. If the appliance needs to preheat before cooking begins, report the preheat time separately through the preheatTimeInterval property. | A time interval. |
cookStartTime
, cookCompletionTime
, and isCookCompletionTimeEstimated
are deprecated. Use the cookingTimeInterval
property instead.Discovery
You describe endpoints that support Alexa.Cooking
using the standard discovery mechanism described in Alexa.Discovery.
Set retrievable
to true for all the interfaces and properties that you report when Alexa sends your skill a state report request. Set proactivelyReported
to true for interfaces and properties that you proactively report to Alexa in a change report.
For the full list of display categories, see display categories.
In addition to the usual discovery response fields, for the Cooking
interface, include a configuration object that contains the following fields.
Field | Description | Type | Required |
---|---|---|---|
supportsRemoteStart |
True if Alexa can start the device after a voice command. When false, Alexa prompts the user to push start on the device. The default is false. | Boolean | No |
supportedCookingModes |
The cooking modes that the device supports through this interface. Include OFF . Use other interfaces to specify cooking modes for the same appliance. |
An array of cookingMode values. | Yes |
Discover response example
The following example shows a Discover.Response
message for a microwave that supports the Cooking
, TimeController, and PresetController interfaces.
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "<message id>"
},
"payload": {
"endpoints": [
{
"endpointId": "<unique ID of the endpoint>",
"manufacturerName": "<the manufacturer name of the endpoint>",
"description": "<a description that is shown in the Alexa app>",
"friendlyName": "Microwave",
"displayCategories": ["MICROWAVE"],
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.Cooking",
"version": "3",
"properties": {
"supported": [
{
"name": "cookingMode"
},
{
"name": "foodItem"
},
{
"name": "cookingTimeInterval"
}
],
"proactivelyReported": true,
"retrievable": true
},
"configuration": {
"supportsRemoteStart": false,
"supportedCookingModes": ["OFF", "DEFROST", "REHEAT"]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.Cooking.TimeController",
"version": "3",
"properties": {
"supported": [
{
"name": "requestedCookTime"
}
],
"proactivelyReported": true,
"retrievable": true
},
"configuration": {
"supportsRemoteStart": false,
"supportedCookingModes": ["DEFROST", "REHEAT"]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.Cooking.PresetController",
"version": "3",
"properties": {
"supported": [
{
"name": "presetName"
},
{
"name": "requestedFoodDoneness"
}
],
"proactivelyReported": true,
"retrievable": true
},
"configuration": {
"presetCatalogId": "<catalog ID>",
"supportsRemoteStart": false,
"supportedCookingModes": ["PRESET", "DEFROST", "REHEAT"]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
}
]
}
]
}
}
}
Directives
SetCookingMode directive
Support the SetCookingMode
directive so that customers can set the cooking mode for a device.
The following examples show some customer utterances:
Alexa, stop the microwave.
Alexa, defrost three pounds of meat in my microwave.
SetCookingMode directive payload details
Field | Description | Type |
---|---|---|
cookingMode |
The cooking mode for the cooking session, such as DEFROST . |
A cookingMode object. |
foodItem |
The food to cook. The directive includes this field only if the user specifies it. | A foodItem object. |
SetCookingMode directive example
The following example illustrates a SetCookingMode
directive that Alexa sends to your skill.
{
"directive": {
"header": {
"namespace": "Alexa.Cooking",
"name": "SetCookingMode",
"messageId": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "<endpoint id>",
"cookie": {}
},
"payload": {
"cookingMode": {
"value": "DEFROST"
},
"foodItem": {
"foodName": "meat",
"foodQuantity": {
"@type": "Weight",
"value": 3,
"unit": "POUND"
}
}
}
}
}
SetCookingMode directive example to turn off a device
The following example illustrates a SetCookingMode
directive that Alexa sends to your skill to turn off a device.
{
"directive": {
"header": {
"namespace": "Alexa.Cooking",
"name": "SetCookingMode",
"messageId": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "<endpoint id>",
"cookie": {}
},
"payload": {
"cookingMode": {
"value": "OFF"
}
}
}
}
SetCookingMode response event
If you handle a SetCookingMode
directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties.
OFF
, include the cooking mode property but no other properties in your response.SetCookingMode response event example
The following example shows a response to a SetCookingMode
directive. The context contains the values of all properties relevant to the current cooking action, even those properties defined by other interfaces.
cookingMode
property in the context of your response.
{
"event":{
"header":{
"namespace": "Alexa",
"name": "Response",
"messageId": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "<endpoint id>"
},
"payload": {}
},
"context":{
"properties":[
{
"namespace": "Alexa.Cooking",
"name": "cookingMode",
"value": "PRESET",
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "foodItem",
"value":{
"foodName": "Salmon",
"foodQuantity":{
"@type": "Weight",
"value": 5.5,
"unit": "POUND"
}
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "cookingTimeInterval",
"value": {
"start": "2019-11-11T21:00:00Z",
"end": "2019-11-11T22:30:00Z"
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
SetCookingMode directive error handling
If you can't handle a SetCookingMode
directive successfully, respond with an Alexa.Cooking.ErrorResponse event. You can also respond with a generic Alexa.ErrorResponse event if your error is generic, and not specific to cooking.
State reporting
Alexa sends a ReportState
directive to request information about the state of an endpoint. When Alexa sends a ReportState
directive, you send a StateReport
event in response. The response contains the current state of all retrievable properties in the context object. You identify your retrievable properties in your discovery response. For more information about state reports, see Understand State Reporting.
OFF
, include the cooking mode property but no other properties in your StateReport
response.StateReport response event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"messageId": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"endpointId": "<endpoint id>"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.Cooking",
"name": "cookingMode",
"value": "BAKE",
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "foodItem",
"value":{
"foodName": "Salmon",
"foodQuantity":{
"@type": "Weight",
"value": 5.5,
"unit": "POUND"
}
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "cookingTimeInterval",
"value": {
"start": "2019-11-11T21:00:00Z",
"end": "2019-11-11T22:30:00Z"
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
Change reporting
You send a ChangeReport
event to proactively report changes in the state of an endpoint. You identify the properties that you proactively report in your discovery response. For more information about change reports, see Understand State Reporting.
OFF
, include the cooking mode property but no other properties in your ChangeReport
.ChangeReport event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "<message id>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "<endpoint id>"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.Cooking",
"name": "cookingMode",
"value": "BAKE",
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "foodItem",
"value":{
"foodName": "Roast",
"foodQuantity":{
"@type": "Weight",
"value": 5.5,
"unit": "POUND"
}
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.Cooking",
"name": "cookingTimeInterval",
"value": {
"start": "2019-11-11T21:00:00Z",
"end": "2019-11-11T22:30:00Z"
},
"timeOfSample": "2019-11-11T21:20:45Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
},
"context": {}
}