Alexa.TimeHoldController Interface
Implement the Alexa.TimeHoldController
interface in your Alexa skill so that users can pause a variety of devices. For example, you can pause a microwave while it is cooking. For more information about cooking skills, see Build Smart Home Skills for Cooking Appliances.
For the list of languages that the TimeHoldController
interface supports, see List of Alexa Interfaces and Supported Languages.
Utterances
When you use the Alexa.TimeHoldController
interface, the voice interaction model is already built for you. 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.
Properties
The Alexa.TimeHoldController
interface uses the holdStartTime
and holdEndTime
properties as the primary properties. The properties are specified in UTC, and are strings in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ.
Discovery
You describe endpoints that support Alexa.TimeHoldController
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 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 does not 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.
{
"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.TimeHoldController",
"version": "3",
"properties": {
"supported": [
{
"name": "holdStartTime"
},
{
"name": "holdEndTime"
}
],
"proactivelyReported": true,
"retrievable": true
},
"configuration": {
"allowRemoteResume": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
}
]
}
]
}
}
}
Directives
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": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "<endpoint id>",
"cookie": {}
},
"payload": {}
}
}
Hold response event
If you handle a Hold
directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties.
Hold response event example
The following example shows a response to a Hold
directive.
{
"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.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": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "<endpoint id>",
"cookie": {}
},
"payload": {}
}
}
Resume response event
If you handle a Resume
directive successfully, respond with an Alexa.Response event. In the context object, include the values of all relevant properties.
Resume response event example
The following example shows a response to a Resume
directive.
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"messageId": "<message id>",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"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 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.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 proactively report changes 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
{
"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": "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": {}
}