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

Alexa.Cooking.TimeController Interface

The Alexa.Cooking.TimeController capability interface describes messages used to control appliances that cook by time and power level. For more information about cooking skills, see Build Smart Home Skills for Cooking Appliances.

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

Utterances

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

Alexa, two minutes on the microwave.
Alexa, 30 more seconds to the microwave.

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

Properties

The Alexa.TimeController interface uses the requestedCookTime and cookingPowerLevel properties as the primary properties. The requestedCookTime property represents the duration of a cooking session. The cookingPowerLevel property represents power level of a cooking session expressed as an enumeratedPowerLevel or an integralPowerLevel.

Discovery

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

Set retrievable to true for all of 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 TimeController, include a configuration object that contains the following fields.

Field Description Type Required
supportsRemoteStart True if Alexa can start the device after a customer's voice command. When false, Alexa sends the CookByTime 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. Include TIMECOOK, and specify the default cooking mode as the first item in the array. An array of cookingMode values. Yes
enumeratedPowerLevels The enumerated powerlevels that the device supports. An array of enumeratedPowerLevels. No
integralPowerLevels The integral power levels that the device supports. An array of integralPowerLevels. No

Discover response example

The following example shows a Discover.Response message for a microwave endpoint that supports the Alexa.TimeController and Alexa.PowerController 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.TimeController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "requestedCookTime"
                  },
                  {
                    "name": "cookingPowerLevel"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "supportsRemoteStart": false,
                "supportedCookingModes": ["TIMECOOK", "DEFROST", "REHEAT"],
                "enumeratedPowerLevels": ["LOW", "MEDIUM", "HIGH"],
                "integralPowerLevels": []
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.PowerController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "powerState"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            }
          ]
        }
      ]
    }
  }
}

Directives

CookByTime directive

Support the CookByTime directive so that customers can start a cooking session and specify the cooking time.

The following example shows a customer utterance:

Alexa, two minutes on the microwave.

CookByTime directive payload details

Field Description Type
cookTime The amount of time to cook. This field is always included in the payload. A duration object.
cookingMode The cooking mode for the cooking session, such as DEFROST. If cookingMode is not present, choose the default cooking mode for the device, such as TIMECOOK. A cookingMode object or string.
cookingPowerLevel The power for the cooking session, such as LOW. If cookingPowerLevel is not present, choose the default cooking power for the device, such as HIGH. An enumeratedPowerLevel or an integralPowerLevel.
foodItem The food to cook. This field is only included if necessary. A foodItem object.

CookByTime directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Cooking.TimeController",
      "name": "CookByTime",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>",
      "cookie": {}
    },
    "payload": {
      "cookTime": "PT3M",
      "cookingPowerLevel": {
        "@type": "EnumeratedPowerLevel",
        "value": "LOW"
      }
    }
  }
}

CookByTime response event

If you handle a CookByTime 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.

CookByTime response event example

The following example shows a response to a CookByTime 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.

{
  "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",
         "name": "cookingMode",
         "value": "TIMECOOK",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking",
         "name": "cookCompletionTime",
         "value": "2017-08-31T23:55Z",
         "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": "Rice Pilaf",
            "foodCategory": "Rice",
            "foodQuantity":{
               "@type": "Volume",
               "value": "2",
               "unit": "US_FLUID_CUP"
            }
         },
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "requestedCookTime",
         "value": "PT25M",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "cookingPowerLevel",
         "value":{
            "@type": "EnumeratedPowerLevel",
            "value": "HIGH"
         },
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      }
    ]
  }
}

CookByTime directive error handling

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

AdjustCookTime directive

Support the AdjustCookTime directive so that customers can adjust the cooking time.

The following example shows a customer utterance:

Alexa, 30 more seconds to the microwave.

AdjustCookTime directive payload details

Field Description Type
cookTimeDelta The amount by which to change the cook time. A duration object.

AdjustCookTime directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Cooking.TimeController",
      "name": "AdjustCookTime",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>",
      "cookie": {}
    },
    "payload": {
      "cookTimeDelta": "PT30S"
    }
  }
}

AdjustCookTime response event

If you handle an AdjustCookTime 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.

AdjustCookTime response event example

The following example shows a response to an AdjustCookTime 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.

{
  "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",
         "name": "cookingMode",
         "value": "TIMECOOK",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking",
         "name": "cookCompletionTime",
         "value": "2017-08-31T23:55Z",
         "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": "Rice Pilaf",
            "foodCategory": "Rice",
            "foodQuantity":{
               "@type": "Volume",
               "value": "2",
               "unit": "US_FLUID_CUP"
            }
         },
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "requestedCookTime",
         "value": "PT25M",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "cookingPowerLevel",
         "value":{
            "@type": "EnumeratedPowerLevel",
            "value": "HIGH"
         },
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      }
    ]
  }
}

AdjustCookTime directive error handling

If you can't handle an AdjustCookTime 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",
         "name": "cookingMode",
         "value": "TIMECOOK",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking",
         "name": "cookCompletionTime",
         "value": "2017-08-31T23:55Z",
         "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": "Rice Pilaf",
            "foodCategory": "Rice",
            "foodQuantity":{
               "@type": "Volume",
               "value": "2",
               "unit": "US_FLUID_CUP"
            }
         },
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "requestedCookTime",
         "value": "PT25M",
         "timeOfSample": "2017-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.Cooking.TimeController",
         "name": "cookingPowerLevel",
         "value":{
            "@type": "EnumeratedPowerLevel",
            "value": "HIGH"
         },
         "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. You identify the properties that you proactively report in your discovery response. For more information about change reports, see Understand State Reporting.

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": "TIMECOOK",
             "timeOfSample": "2017-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          },
          {
             "namespace": "Alexa.Cooking.TimeController",
             "name": "requestedCookTime",
             "value": "PT25M",
             "timeOfSample": "2017-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          },
          {
             "namespace": "Alexa.Cooking.TimeController",
             "name": "cookingPowerLevel",
             "value":{
                "@type": "EnumeratedPowerLevel",
                "value": "HIGH"
             },
             "timeOfSample": "2017-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          },
          {
             "namespace": "Alexa.Cooking",
             "name": "cookCompletionTime",
             "value": "2017-08-31T23:55Z",
             "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": true,
             "timeOfSample": "2017-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          },
          {
             "namespace": "Alexa.Cooking",
             "name": "foodItem",
             "value":{
                "foodName": "Rice Pilaf",
                "foodCategory": "Rice",
                "foodQuantity":{
                   "@type": "Volume",
                   "value": "2",
                   "unit": "US_FLUID_CUP"
                }
             },
             "timeOfSample": "2017-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {}
}