Alexa.Cooking.TimeController Interface 3


Implement the Alexa.Cooking.TimeController interface in your Alexa skill so that users can control appliances that cook by time, temperature, and power level. Through this interface, users can cook by time alone, by time and power level, or by time and temperature. Users can't cook by both temperature and power level.

You must use the Alexa.TimeController interface in conjunction with the Alexa.Cooking interface. For details about cooking skills, see Build Smart Home Skills for Cooking Appliances.

For the list of languages that the Alexa.TimeController interface supports, see List of Alexa Interfaces and Supported Languages. For the definitions of the message properties, see Alexa Interface Message and Property Reference.

Utterances

The Alexa.Cooking.TimeController interface uses the pre-built voice interaction model. The following examples show some customer utterances:

Alexa, two minutes on the microwave.
Alexa, add thirty more seconds to the microwave.
Alexa, cook for three minutes on low in microwave.
Alexa, cook for three minutes on level five in the microwave.
Alexa, cook chicken for two minutes.
Alexa, defrost chicken for three minutes on low in the microwave.
Alexa, bake my cookies at three hundred and fifty degrees for ten minutes.

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

Properties and objects

The Alexa.TimeController interface defines the following properties and objects.

Reportable 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.

PowerLevel object

Use powerLevel to represent the power level of a device. The powerLevel object contains a type field that identifies the descendant type. The @type field determines the values that you can specify for the powerLevel. Using the following type values for powerLevel.

The following example shows powerLevel that contains an EnumeratedPowerLevel.

{
"powerLevel": {
    "@type": "EnumeratedPowerLevel",
    "value": "MEDIUM"
  }
}

The following example shows powerLevel that contains an IntegralPowerLevel.

{
"powerLevel": {
    "@type": "IntegralPowerLevel",
    "value": 5
  }
}

EnumeratedPowerLevel values

Provides a cooking power level from a list of values. A descendant of the polymorphic PowerLevel.

Field Description Type
value Indicates the power level. Valid values: LOW, MEDIUM, HIGH String

The following example shows an EnumeratedPowerLevel object.

{
  "name": "EnumeratedPowerLevel",
  "value": "MEDIUM"
}

IntegralPowerLevel values

Provides a cooking power level represented as an integer on a number scale. A descendant of the polymorphic PowerLevel.

Field Description Type
value Number indicating the power level. Integer

The following example shows an IntegralPowerLevel object.

{
  "name": "IntegralPowerLevel",
  "value": 5
}

Discovery

You describe endpoints that support Alexa.TimeController by 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.

To let Alexa know the health of your device, also implement the Alexa.EndpointHealth interface.

Configuration object

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 Cooking modes that the device supports through this interface. You can support other cooking modes by the same appliance through other interfaces. Array of CookingMode values Yes
enumeratedPowerLevels The enumerated power levels that the device supports, such as LOW, MEDIUM, HIGH. If you don't support enumerated power levels, and the user attempts to control the power with a value such as HIGH, Alexa reports an error to the user. Array of EnumeratedPowerLevel values No
integralPowerLevels The integral power levels that the device supports. If you don't support integral power levels, and the user attempts to control the power with an integral value, Alexa reports an error to the user. Array of IntegralPowerLevel values No

Discover response example

The following example shows a Discover.Response message for a microwave that supports the TimeController and Cooking interfaces.

Copied to clipboard.

{
  "event": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover.Response",
      "payloadVersion": "3",
      "messageId": "Unique identifier, preferably a version 4 UUID"
    },
    "payload": {
      "endpoints": [
        {
          "endpointId": "Unique ID of the endpoint",
          "manufacturerName": "Manufacturer of the endpoint",
          "description": "Description to be 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": ["DEFROST", "REHEAT"],
                "enumeratedPowerLevels": ["LOW", "MEDIUM", "HIGH"],
                "integralPowerLevels": [1, 2, 3, 4, 5]
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.Cooking",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "cookingMode"
                  },
                  {
                    "name": "foodItem"
                  },
                  {
                    "name": "cookingTimeInterval"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "supportsRemoteStart": false,
                "supportedCookingModes": ["REHEAT", "DEFROST", "PRESET", "OFF"]
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            }
          ]
        }
      ]
    }
  }
}

Directives

Alexa sends the following Alexa.Cooking.TimeController interface directives to your skill.

CookByTime directive

Support the CookByTime directive so that customers can start a cooking session. Users can cook by time alone, by time and power level, or by time and temperature. Users can't cook by both temperature and power level.

The following example shows a customer utterance:

Alexa, two minutes on the microwave.

CookByTime directive example

The following example illustrates a CookByTime directive that Alexa sends to your skill.

{
  "directive": {
    "header": {
      "namespace": "Alexa.Cooking.TimeController",
      "name": "CookByTime",
      "messageId": "Unique version 4 UUID",
      "correlationToken": "Opaque correlation token",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID",
      "cookie": {}
    },
    "payload": {
      "cookTime": "PT3M",
      "cookingPowerLevel": {
        "@type": "EnumeratedPowerLevel",
        "value": "LOW"
      }
    }
  }
}

CookByTime directive payload

Field Description Type
cookTime Amount of time to cook. This field is always included in the payload. Duration object
cookingMode Cooking mode for the cooking session, such as REHEAT. If cookingMode isn't present, choose the default cooking mode for the device, such as BAKE. CookingMode object
foodItem The food to cook. This field is only included if the user specifies it. FoodItem object
cookingPowerLevel Power for the cooking session, such as LOW. This field is only included only if the user specifies it. PowerLevel object
targetCookingTemperature Temperature for the cooking session. This field is only included if the user specifies it. Temperature object

CookByTime response

If you handle a CookByTime directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties.

The following example shows a response to a CookByTime directive. The context contains the values of all properties and interfaces relevant to the current cooking action.

Copied to clipboard.

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "messageId": "Unique identifier, preferably a version 4 UUID",
      "correlationToken": "Opaque correlation token that matches the request",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
         "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": "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
      }
    ]
  }
}

CookByTime directive error handling

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

AdjustCookTime directive

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

The following example shows a customer utterance:

Alexa, add 30 more seconds to the microwave.

AdjustCookTime directive example

The following example illustrates an AdjustCookTime directive that Alexa sends to your skill.

{
  "directive": {
    "header": {
      "namespace": "Alexa.Cooking.TimeController",
      "name": "AdjustCookTime",
      "messageId": "Unique version 4 UUID",
      "correlationToken": "Opaque correlation token",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID",
      "cookie": {}
    },
    "payload": {
      "cookTimeDelta": "PT30S"
    }
  }
}

AdjustCookTime directive payload

Field Description Type
cookTimeDelta Amount by which to change the cook time. Duration object

AdjustCookTime response

If you handle an AdjustCookTime directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties.

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.

Copied to clipboard.

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "messageId": "Unique identifier, preferably a version 4 UUID",
      "correlationToken": "Opaque correlation token that matches the request",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
         "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": "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
      }
    ]
  }
}

AdjustCookTime directive error handling

If you can't handle an AdjustCookTime 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 details about state reports, see Understand State Reporting.

StateReport response example

Copied to clipboard.

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "StateReport",
      "messageId": "Unique identifier, preferably a version 4 UUID",
      "correlationToken": "Opaque correlation token that matches the request",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
         "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": "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
      }
    ]
  }
}

Change reporting

You send a ChangeReport event to report changes proactively in the state of an endpoint. You identify the properties that you proactively report in your discovery response. For details about change reports, see Understand State Reporting.

ChangeReport event example

Copied to clipboard.

{  
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "ChangeReport",
      "messageId": "Unique identifier, preferably a version 4 UUID",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "OAuth2.0 bearer token"
      },
      "endpointId": "Endpoint ID"
    },
    "payload": {
      "change": {
        "cause": {
          "type": "PHYSICAL_INTERACTION"
        },
        "properties": [
          {
             "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": "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": {
    "namespace": "Alexa.EndpointHealth",
    "name": "connectivity",
    "value": {
      "value": "OK"
    },
    "timeOfSample": "2019-11-11T21:20:45Z",
    "uncertaintyInMilliseconds": 0
  }
}

Was this page helpful?

Last updated: Nov 22, 2023