Alexa.PowerLevelController Interface 3


Implement the Alexa.PowerLevelController interface in your Alexa skill so that users can control the power level of their smart home devices. For more details about Smart Home skills, see Understand Smart Home Skills.

Use this interface for devices that support power-level control, such as a dimmer switch. For more general properties that can be expressed as a percentage, implement the Alexa.PercentageController interface instead.

For the list of languages that the PowerLevelController 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

When you use the Alexa.PowerLevelController interface, the voice interaction model is already built for you. After the user says one of the following utterances, Alexa sends a corresponding directive to your skill.

The following examples show some user utterances:

Alexa, set the power to 40 percent on the fan.
Alexa, increase the power level by 12 on the light switch.

Alexa, setze die Leistung auf 40 Prozent auf dem Lüfter.
Alexa, erhöhe die Leistung auf Lichtschalter um 12.

Alexa, règle la puissance à quarante pour cent sur le ventilateur.
Alexa, augmente le niveau de puissance de douze sur l'interrupteur d'éclairage.

Alexa, imposta la potenza della ventola al 40 percento.
Alexa, aumenta di 12 il livello di potenza dell'interruttore della luce.

アレクサ、ファンの風量を40パーセントにして。
アレクサ、電気のスイッチでレベルを12にあげて。

Alexa, pon la potencia del ventilador al 40 por ciento.
Alexa, aumenta el interruptor de la luz a 12.

Alexa, zet de snelheid van de ventilator op 40 procent.
Alexa, verhoog het sterkteniveau van de lichtschakelaar met 12.
Alexa, verhoog het vermogensniveau van de lichtschakelaar met 12.

Reportable properties

The Alexa.PowerLevelController interface uses the powerLevel property as the primary property. The property represents the power level of a device expressed as an integer percentage between 0 and 100 inclusive. If you use the powerLevel property to represent a change, valid values are from –100 to 100 inclusive.

Discovery

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

Set retrievable to true for all 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.

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

Discover response example

The following example shows a Discover.Response message for a light that supports the Alexa.PowerLevelController and Alexa.ColorController 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": "Living Room Light",
          "displayCategories": ["LIGHT"],
          "additionalAttributes":  {
            "manufacturer": "Manufacturer of the endpoint",
            "model" : "Model of the device",
            "serialNumber": "Serial number of the device",
            "firmwareVersion" : "Firmware version of the device",
            "softwareVersion": "Software version of the device",
            "customIdentifier": "Optional custom identifier for the device"
          },
          "cookie": {},
          "capabilities": [
            {
              "type": "AlexaInterface",
              "interface": "Alexa.PowerLevelController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "powerLevel"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.ColorController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "color"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              }
            },            
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            }
          ]
        }
      ]
    }
  }
}

Directives

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

SetPowerLevel directive

Support the SetPowerLevel directive so that users can set the power level on devices.

The following examples show user utterances:

Alexa, set the power to 40 percent on the fan.

Alexa, setze die Leistung auf 40 Prozent auf dem Lüfter.

Alexa, règle la puissance à quarante pour cent sur le ventilateur.

Alexa, imposta la potenza della ventola al 40 percento.

アレクサ、ファンの風量を40パーセントにして。

Alexa, pon la potencia del ventilador al 40 por ciento.

Alexa, zet de snelheid van de ventilator op 40 procent.

SetPowerLevel directive example

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

{
  "directive": {
    "header": {
      "namespace": "Alexa.PowerLevelController",
      "name": "SetPowerLevel",
      "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": {
      "powerLevel": 40
    }
  }
}

SetPowerLevel directive payload

Field Description Type
powerLevel Power level to set the device to. Integer

SetPowerLevel response

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

The following example shows a SetPowerLevel response.

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.PowerLevelController",
        "name": "powerLevel",
        "value": 40,
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "uncertaintyInMilliseconds": 500
      }
    ]
  }
}

SetPowerLevel directive error handling

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

AdjustPowerLevel directive

Support the AdjustPowerLevel directive so that users can adjust the power level on devices.

The following examples show user utterances:

Alexa, increase the power level by 12 on the light switch.

Alexa, erhöhe die Leistung auf Lichtschalter um 12.

Alexa, augmente le niveau de puissance de douze sur l'interrupteur d'éclairage.

Alexa, aumenta di 12 il livello di potenza dell'interruttore della luce.

アレクサ、電気のスイッチでレベルを12にあげて。

Alexa, aumenta el interruptor de la luz a 12.

Alexa, verhoog het sterkteniveau van de lichtschakelaar met 12.
Alexa, verhoog het vermogensniveau van de lichtschakelaar met 12.

AdjustPowerLevel directive example

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

{
  "directive": {
    "header": {
      "namespace": "Alexa.PowerLevelController",
      "name": "AdjustPowerLevel",
      "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": {
      "powerLevelDelta": 12
    }
  }
}

AdjustPowerLevel directive payload

Field Description Type
powerLevelDelta Amount by which to change the power level. Integer

AdjustPowerLevel response

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

The following example shows a AdjustPowerLevel response.

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.PowerLevelController",
        "name": "powerLevel",
        "value": 52,
        "timeOfSample": "2017-02-03T16:20:50.52Z",
        "uncertaintyInMilliseconds": 500
      }
    ]
  }
}

AdjustPowerLevel directive error handling

If you can't handle an AdjustPowerLevel directive successfully, respond with an Alexa.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 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.

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.PowerLevelController",
        "name": "powerLevel",
        "value": 52,
        "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.PowerLevelController",
            "name": "powerLevel",
            "value": 75,
            "timeOfSample": "2024-05-01T09:32:05.05Z",
            "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {
    "namespace": "Alexa.EndpointHealth",
    "name": "connectivity",
    "value": {
      "value": "OK"
    },
    "timeOfSample": "2024-05-01T09:25:45.25Z",
    "uncertaintyInMilliseconds": 0
  }
}

Was this page helpful?

Last updated: Aug 23, 2024