Alexa.TimeHoldController Interface 3


Implement the Alexa.TimeHoldController interface in your Alexa cooking skill so that users can pause a variety of devices. For example, you can pause a microwave while it's cooking.

You must use the Alexa.TimeHoldController 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.TimeHoldController 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.TimeHoldController interface uses the pre-built voice interaction model. The following examples show some customer utterances:

Alexa, pause the microwave.
Alexa, hold the sous vide.
Alexa, restart the microwave.

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

Reportable properties

The Alexa.TimeHoldController interface uses the holdStartTime and holdEndTime properties as the primary properties. Specify the properties in UTC strings in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ.

Discovery

You describe endpoints that support Alexa.TimeHoldController 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 TimeHoldController, include a configuration object that contains the following fields.

Field Description Type
allowRemoteResume True if Alexa can restart the operation on the device. When false, Alexa doesn't send the Resume directive. Instead, Alexa prompts the user to push start on the device. Boolean

Discover response example

The following example shows a Discover.Response message for a microwave that supports the Alexa.TimeHoldController interface.

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.TimeHoldController",
                        "version": "3",
                        "properties": {
                            "supported": [{
                                    "name": "holdStartTime"
                                },
                                {
                                    "name": "holdEndTime"
                                }
                            ],
                            "proactivelyReported": true,
                            "retrievable": true
                        },
                        "configuration": {
                            "allowRemoteResume": true
                        }
                    },
                    {
                        "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.EndpointHealth",
                        "version": "3",
                        "properties": {
                            "supported": [{
                                "name": "connectivity"
                            }],
                            "proactivelyReported": false,
                            "retrievable": true
                        }
                    },
                    {
                        "type": "AlexaInterface",
                        "interface": "Alexa",
                        "version": "3"
                    }
                ]
            }]
        }
    }
}

Directives

Alexa sends the following Alexa.TimeHoldController interface directives to your skill.

Hold directive

Support the Hold directive so that customers can pause an action that a device is doing.

The following example shows a customer utterance:

Alexa, pause the microwave.

Hold directive example

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

{
  "directive": {
    "header": {
      "namespace": "Alexa.TimeHoldController",
      "name": "Hold",
      "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": {}
  }
}

Hold response

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

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.TimeHoldController",
                "name": "holdStartTime",
                "value": "2018-05-31T14:00Z",
                "timeOfSample": "2018-08-31T23:30:00Z",
                "uncertaintyInMilliseconds": 0
            },
            {
                "namespace": "Alexa.TimeHoldController",
                "name": "holdEndTime",
                "value": "2018-05-31T14:30Z",
                "timeOfSample": "2018-08-31T23:30:00Z",
                "uncertaintyInMilliseconds": 0
            }
        ]
    }
}

Hold directive error handling

If you can't handle a Hold directive successfully, respond with an Alexa.ErrorResponse event. If your device supports cooking, you can also respond with an Alexa.Cooking.ErrorResponse event when appropriate.

Resume directive

Support the Resume directive so that customers can restart an action that a device is doing.

The following example shows a customer utterance:

Alexa, restart the microwave.

Resume directive example

The following example illustrates a Resume directive that Alexa sends to your skill. The payload for the Resume directive is empty.

{
  "directive": {
    "header": {
      "namespace": "Alexa.TimeHoldController",
      "name": "Resume",
      "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": {}
  }
}

Resume response

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

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": {}
}

Resume directive error handling

If you can't handle a Resume directive successfully, respond with an Alexa.ErrorResponse event. If your device supports cooking, you can also respond with an Alexa.Cooking.ErrorResponse event when appropriate.

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 details about state reports, see Understand State and Change 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.TimeHoldController",
         "name": "holdStartTime",
         "value": "2018-05-31T14:00Z",
         "timeOfSample": "2018-08-31T23:30:00Z",
         "uncertaintyInMilliseconds": 0
      },
      {
         "namespace": "Alexa.TimeHoldController",
         "name": "holdEndTime",
         "value": "2018-05-31T14:30Z",
         "timeOfSample": "2018-08-31T23:30:00Z",
         "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 and Change 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": "PERIODIC_POLL"
        },
        "properties": [
          {
             "namespace": "Alexa.TimeHoldController",
             "name": "holdStartTime",
             "value": "2018-05-31T14:00Z",
             "timeOfSample": "2018-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          },
          {
             "namespace": "Alexa.TimeHoldController",
             "name": "holdEndTime",
             "value": "2018-05-31T14:30Z",
             "timeOfSample": "2018-08-31T23:30:00Z",
             "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {
    "namespace": "Alexa.EndpointHealth",
    "name": "connectivity",
    "value": {
      "value": "OK"
    },
    "timeOfSample": "2018-08-31T23:30:00Z",
    "uncertaintyInMilliseconds": 0
  }
}

Was this page helpful?

Last updated: Nov 22, 2023