感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Alexa.Cooking.PresetController Interface

Implement the Alexa.Cooking.PresetController capability interface so that users can control cooking appliances that cook with preset settings, such as a microwave with a popcorn setting. For more information about cooking skills, see Build Smart Home Skills for Cooking Appliances.

For the list of locales that are supported for the PresetController interface, see List of Capability Interfaces and Supported Locales.

Utterances

When you use the Alexa.Cooking.PresetController interface, the voice interaction model is already built for you. The following examples show some user utterances:

Alexa, microwave the popcorn.
Alexa, cook the pizza in the microwave.

Alexa, defrost five pounds of chicken breast.

After the user says one of these utterances, Alexa sends a corresponding directive to your skill.

Preset catalogs

Preset cooking relies on a catalog that you provide to the Alexa team. Catalogs can vary by brand, appliance type, and model. You identify the catalog that your device uses in your discover response. Items from the catalog are sent to your skill in the CookByPreset directive.

To submit a preset cooking catalog for Alexa to use, send an email to alexa-kitchen-presets@amazon.com. In the subject line provide the appliance brand, the appliance type, and the appliance model.

For example, your email could look like the following.

To: alexa-kitchen-presets@amazon.com
Subject: Brand: *your appliance brand*, Appliance type: *your appliance type*, Appliance model: *your appliance model*

Within two weeks, you receive a response that includes the following information:

  • Instructions for uploading your catalog.

    • How to format your catalog in Excel.
    • Where to upload the Excel file that contains your catalog.
  • The ID for your preset catalog.

    • The ID is between 3 and 63 characters long, and contains only numbers, lower case letters, and hyphens.
    • You specify the catalog ID in your discover response for devices that use the catalog.

Properties

The Alexa.Cooking.PresetController interface uses the presetName property as the primary property. The presetName property represents the name of the preset from the preset catalog.

Discovery

You describe endpoints that support Alexa.Cooking.PresetController using the standard discovery mechanism described in Alexa.Discovery.

Set retrievable to true for the properties that you report when Alexa sends your skill a state report request. Set proactivelyReported to true for the 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 PresetController, include a configuration object that contains the following fields.

Field Description Type Required
presetCatalogId The ID for the preset catalog. For more information, see preset catalogs. String Yes
supportsRemoteStart True if Alexa can start the device after a customer's voice command. When false, Alexa sends the CookByPreset directive to set the parameters for the cook session, and 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. Specify the default cooking mode as the first item in the array. Other cooking modes can be supported by the same appliance through other interfaces. An array of cookingMode strings. Yes

Discover response example

The following example shows a Discover.Response message for a microwave endpoint that supports the Alexa.Cooking and Alexa.Cooking.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": "cookingTimeInterval"
                  },
                  {
                    "name": "foodItem"
                  },
                  {
                    "name": "cookingSessionId"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "supportsCookingEvents": true,
                "supportsRemoteStart": false,
                "supportedCookingModes": ["REHEAT", "DEFROST", "PRESET", "OFF"]
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.Cooking.PresetController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "presetName"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "presetCatalogId": "<catalog ID>",
                "supportedCookingModes": ["REHEAT", "DEFROST"],
                "supportsRemoteStart": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            }
          ]
        }
      ]
    }
  }
}

Directives

CookByPreset directive

Support the CookByPreset directive so that customers can start a cooking session and specify a preset option.

The following examples show customer utterances:

Alexa, defrost five pounds of chicken breast.

CookByPreset directive payload details

Field Description Type
presetName The name of the preset option to use for the cooking session. For more information, see preset catalogs. String
cookingMode The cooking mode for the cooking session, such as BROIL. If cookingMode is not present, choose the default cooking mode for the device, such as BAKE. A cookingMode object or string.
foodItem The food to cook. This field is only included if necessary. A foodItem object.

CookByPreset directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Cooking.PresetController",
      "name": "CookByPreset",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>",
      "cookie": {}
    },
    "payload": {
      "presetName": "pizza",
      "foodItem": {
        "foodName": "pizza",
        "foodCategory": "PIZZA"
      },
      "cookingMode":"PRESET"
    }
  }
}

CookByPreset response event

If you handle a CookByPreset directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token and a scope with an authorization token.

CookByPreset response event example

The following example shows a response to a CookByPreset directive. The context contains the values of all properties relevant to the current cooking action, even though some of the properties are defined by other interfaces.

Example Response

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>"
    },
    "payload":{}
  },
  "context":  {
    "properties": [
      {
        "namespace":"Alexa.Cooking.PresetController",
        "name":"presetName",
        "value":"Salmon",
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds":0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookingMode",
        "value": "PRESET",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookCompletionTime",
        "value": "2017-08-31T23:36:15Z",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isCookCompletionTimeEstimated",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isHolding",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "foodItem",
        "value": {
          "foodName": "sockeye salmon fillet",
          "foodCategory": "FISH",
          "foodQuantity": {
            "@type": "Weight",
            "value": "2.5",
            "unit": "POUND"
          }
        },
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      }
    ]
  }
}

CookByPreset directive error handling

If you can't handle a CookByPreset directive successfully, respond with an Alexa.Cooking.ErrorResponse event.

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 of the 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.

StateReport response event example

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "StateReport",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
        "namespace":"Alexa.Cooking.PresetController",
        "name":"presetName",
        "value":"Salmon",
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds":0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookingMode",
        "value": "PRESET",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookCompletionTime",
        "value": "2017-08-31T23:36:15Z",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isCookCompletionTimeEstimated",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isHolding",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "foodItem",
        "value": {
          "foodName": "sockeye salmon fillet",
          "foodCategory": "FISH",
          "foodQuantity": {
            "@type": "Weight",
            "value": "2.5",
            "unit": "POUND"
          }
        },
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      }
    ]
  }
}

Change reporting

You send a ChangeReport event to proactively report changes in the state of an endpoint. For more information about change reports, see Understand State Reporting.

The ChangeReport contains the value of all properties that changed in the payload object. You must include the instance for each mode property that you are reporting. You identify the properties that you proactively report, and your instance names, in your discovery response.

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.ModeController",
            "instance": "Washer.WashTemperature",
            "name": "mode",
            "value": "WashTemperature.Hot",
            "timeOfSample": "2017-02-03T16:20:50Z",
            "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {
    "properties": [
      {
        "namespace":"Alexa.Cooking.PresetController",
        "name":"presetName",
        "value":"Salmon",
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds":0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookingMode",
        "value": "PRESET",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "cookCompletionTime",
        "value": "2017-08-31T23:36:15Z",
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isCookCompletionTimeEstimated",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "isHolding",
        "value": false,
        "timeOfSample": "2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Cooking",
        "name": "foodItem",
        "value": {
          "foodName": "sockeye salmon fillet",
          "foodCategory": "FISH",
          "foodQuantity": {
            "@type": "Weight",
            "value": "2.5",
            "unit": "POUND"
          }
        },
        "timeOfSample":"2017-08-31T23:30:00Z",
        "uncertaintyInMilliseconds": 0
      }
    ]
  }
}