Alexa.RangeController Interface 3

Implement the Alexa.RangeController interface in your Alexa skill so that users can control the device settings represented by numbers within a minimum and maximum range. You can use the Alexa.RangeController interface to model properties of a device that the user can set to one of a range of values, such as the speed settings on a blender or a fan. The Alexa.RangeController interface is a generic controller interface.

The Alexa.RangeController interface is highly configurable and enables you to model many different kinds of settings for many different kinds of devices. Use one of the following more specific interfaces if it's appropriate for your device:

For the list of languages that the Alexa.RangeController 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.RangeController interface uses the pre-built voice interaction model. The following examples show some user utterances:

Alexa, set the bedroom fan speed to 7.
Alexa, set the fan speed on the bedroom fan to maximum.
Alexa, turn up the bedroom fan speed.
Alexa, decrease the fan speed on the bedroom fan by 3.
Alexa, what's the bedroom fan speed?

アレクサ、扇風機の風量を7にして
アレクサ、扇風機の風量を最大にして
アレクサ、扇風機の風量を上げて
アレクサ、扇風機の風量を3弱めて
アレクサ、扇風機の風量は?

You can optionally enable additional utterances by using semantics. The following examples show some additional user utterances:

Alexa, raise the living room blinds.
Alexa, lower the living room blinds.
Alexa, open the bedroom blinds.
Alexa, close the bedroom blinds.

Alexa, fahre die Rollläden im Wohnzimmer hoch.
Alexa, fahre die Rollläden im Wohnzimmer runter.
Alexa, öffne das Rollo in der Küche.
Alexa, schließe das Rollo in der Küche.

アレクサ、ブラインドを上げて
アレクサ、ブラインドを下げて
アレクサ、カーテンを開いて
アレクサ、カーテンを閉じて

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

Properties and objects

RangeValue property

The Alexa.RangeController interface uses the rangeValue property as the primary property. The property values are numbers, and you specify the minimum value, maximum value, and precision in your discover response. If you use the rangeValue property to represent a change, valid values include negative numbers.

An endpoint can support multiple range controllers. To distinguish between range controllers, you must always include the instance attribute for a rangeValue property. You identify your instance names in your discovery response.

RangeValue property example

Copied to clipboard.

{
  "namespace": "Alexa.RangeController",
  "instance": "Fan.Speed",
  "name": "rangeValue",
  "value": 10
}

Preset object

The Preset object represents a preset value for a range.

The following example shows three Preset objects in a presets array. The presets represent low, medium, and high values for a range of 1 — 10.

Copied to clipboard.

"presets": [
  {
    "value": 1,
    "presetResources": {
    }
  },
  {
    "value": 5,
    "presetResources": {
    }
  },
  {
    "value": 10,
    "presetResources": {
    }
  }
]
Field Description Type
rangeValue The value in the range for the preset. Integer
presetResources Friendly names that users can use to interact with the preset value. PresetResources object

PresetResources object

Use the PresetResources object to provide a set of friendly names that users can use to interact with preset values. The first friendly name is the name that appears in the Alexa app. For details, see Resources and Assets.

The following example shows the preset resources for the high setting on a fan. Users can say phrases like "Alexa, set the fan to fast."

Copied to clipboard.

"presetResources":
{
  "friendlyNames": [
    {
      "@type": "asset",
      "value": {
        "assetId": "Alexa.Value.Maximum"
      }
    },
    {
      "@type": "asset",
      "value": {
        "assetId": "Alexa.Value.High"
      }
    },
    {
      "@type": "text",
      "value": {
        "text": "Highest",
        "locale": "en-US"
      }
    },
    {
      "@type": "text",
      "value": {
        "text": "Fast",
        "locale": "en-US"
      }
    },
    {
      "@type": "text",
      "value": {
        "text": "Alta",
        "locale": "es-MX"
      }
    },
    {
      "@type": "text",
      "value": {
        "text": "Élevée",
        "locale": "fr-CA"
      }
    }
  ]
}

Semantics

Use semantics to enable additional features, such as additional user utterances and announcements when your device requires attention. To use semantics, include a semantics object in your discover response as described in the discovery section.

Use semantics to enable additional utterances

When you use the Alexa.RangeController interface, the voice interaction model is already built for you. Users can interact with your device by saying the standard Alexa.RangeController utterances. For details, see utterances.

You can optionally enable additional utterances by using semantics. When you use semantics, you manually map the phrases "open", "close", "raise", and "lower" to the Alexa.RangeController directives SetRangeValue and AdjustRangeValue. For example, if you have a controller for a window shade, you can map the phrase "raise" to the AdjustRangeValue directive.

Use semantics to enable announcements

You can use semantics to enable announcements to the user when your device requires attention. Announcements take the form, Your <device friendly name>'s <instance friendly name> is <state>. For example, when the bin of their automatic vacuum cleaner is full, Alexa notifies the user with the following announcement: "Your vacuum's bin is full."

To enable announcements, implement the Alexa.ProactiveNotificationSource interface in your Alexa skill. To indicate the states that you support, include a semantics object in your discovery response to map the rangeValue property to one of the Alexa.States values, such as Alexa.States.Full. You trigger announcements by sending an Alexa.ChangeReport to report a change in the device state. For more details about announcement text, see Alexa.ProactiveNotificationSource.

Discovery

You describe endpoints that support Alexa.RangeController 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 connected vehicles that use Alexa user identification, include directiveConfigurations in your discovery response to configure the authentication confidence level and policy name. For details, see directiveConfigurations.

You can model properties of an endpoint that users can't change by setting nonControllable to true. Set nonControllable to true for range controller properties that you want to report to the user, but don't want the user to change.

For each Alexa.RangeController entry in the capabilities array, you can optionally include a semantics object. For details, see use semantics to enable additional utterances and use semantics to enable announcements.

For the full list of display categories, see display categories.

Capabilities array

In addition to the usual discovery response fields, for each Alexa.RangeController entry in the capabilities array, include the following fields.

Field Description Type
instance The name of the range.
For example: Fan.Speed, Camera.Pan, Camera.Tilt, Camera.Zoom
String
capabilityResources Friendly names that users can use to interact with the mode.
If you enable announcements for the instance friendly name, include @type set to text.
CapabilityResources object
configuration.
supportedRange.
minimumValue
The minimum value for the range. Number
configuration.
supportedRange.
maximumValue
The maximum value for the range. Number
configuration.
supportedRange.
precision
The amount by which the values change when moving through the range. This also serves as the default when a user asks to change the value but doesn't specify by how much. Number
unitOfMeasure The unit of measure for the range. unit of measure string
presets Named options that users can specify instead of numbers, such as "medium" or "maximum". Array of Preset objects

Discovery response examples

Fan example

The following example shows a Discover.Response message for a fan that supports the Alexa.RangeController and Alexa.PowerController interfaces.

Semantics for blinds example

The following example shows a Discover.Response message for blinds that support the Alexa.RangeController interface and uses semantics. Use the Alexa.RangeController interface for blinds that can raise and lower to a range of positions. If your blinds only fully open and fully close, use the ModeController interface instead.

You can use the Alexa.RangeController interface for your skills that control blinds in the following locales: de-DE, en-AU, en-CA, en-GB, en-IN, en-US, es-ES, es-MX, es-US, fr-CA, fr-FR, hi-IN, it-IT, ja-JP, pt_BR.

Range and toggle controllers example

The following example shows a Discover.Response message for a fan that supports the PowerController interface and both the Alexa.RangeController and ToggleController interfaces.

Directives

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

SetRangeValue directive

Support the SetRangeValue directive so that users can set the level of features on devices.

The following examples show user utterances:

Alexa, set the bedroom fan speed to 7.
Alexa, set the fan speed on the bedroom fan to maximum.

アレクサ、扇風機の風量を7にして
アレクサ、扇風機の風量を最大にして

SetRangeValue directive example

The following example shows a SetRangeValue directive that Alexa sends to your skill.

{
  "directive": {
    "header": {
      "namespace": "Alexa.RangeController",
      "instance": "Fan.Speed",
      "name": "SetRangeValue",
      "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": {
      "rangeValue": 7
    }
  }
}

SetRangeValue directive payload

Property Description Type Required

rangeValue

Value to set the feature of the device to.

Number

Yes

SetRangeValue response

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

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.RangeController",
        "instance": "Fan.Speed",
        "name": "rangeValue",
        "value": 7,
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "uncertaintyInMilliseconds": 500
      }
    ]
  }
}

SetRangeValue directive error handling

If you can't handle a SetRangeValue directive successfully, respond with an Alexa.ErrorResponse event. If your error is safety related, respond with an Alexa.Safety.ErrorResponse.

AdjustRangeValue directive

Support the AdjustRangeValue directive so that users can adjust the level of features on devices.

The following examples show user utterances:

Alexa, turn up the bedroom fan speed.
Alexa, decrease the fan speed on the bedroom fan by 3.

アレクサ、扇風機の風量を上げて
アレクサ、扇風機の風量を3弱めて

AdjustRangeValue directive example

The following example shows an AdjustRangeValue directive that Alexa sends to your skill.

{
  "directive": {
    "header": {
      "namespace": "Alexa.RangeController",
      "instance": "Fan.Speed",
      "name": "AdjustRangeValue",
      "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": {
      "rangeValueDelta": -3,
      "rangeValueDeltaDefault": false
    }
  }
}

AdjustRangeValue directive payload

Property Description Type Required

rangeValueDelta

Amount by which to change the feature of the device. If the user doesn't specify the amount, the value defaults to precision.

Number

Yes

rangeValueDeltaDefault

Set to false, if the user specified the amount of the change.

Boolean

Yes

AdjustRangeValue response event

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

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.RangeController",
        "instance": "Fan.Speed",
        "name": "rangeValue",
        "value": 4,
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "uncertaintyInMilliseconds": 500
      }
    ]
  }
}

AdjustRangeValue directive error handling

If you can't handle an AdjustRangeValue directive successfully, respond with an Alexa.ErrorResponse event. If your error is safety related, respond with an Alexa.Safety.ErrorResponse.

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

Support the ReportState directive so that users can ask about the features of their devices.

The following examples show some user utterances:

Alexa, what's the fan speed?

アレクサ、扇風機の風量は?

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.RangeController",
        "instance": "Fan.Speed",
        "name": "rangeValue",
        "value": 4,
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "uncertaintyInMilliseconds": 500
      },
      {
        "namespace": "Alexa.PowerController",
        "name": "powerState",
        "value": "ON",
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "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": "PHYSICAL_INTERACTION"
        },
        "properties": [
          {
            "namespace": "Alexa.RangeController",
            "instance": "Fan.Speed",
            "name": "rangeValue",
            "value": 10,
            "timeOfSample": "2017-02-03T16:20:50.52Z",
            "uncertaintyInMilliseconds": 500
          },
          {
            "namespace": "Alexa.PowerController",
            "name": "powerState",
            "value": "ON",
            "timeOfSample": "2017-02-03T16:20:50.52Z",
            "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {
    "namespace": "Alexa.EndpointHealth",
    "name": "connectivity",
    "value": {
      "value": "OK"
    },
    "timeOfSample": "2017-02-03T16:20:50.52Z",
    "uncertaintyInMilliseconds": 0
  }
}