Alexa.Networking.AccessController Interface

Implement the Alexa.Networking.AccessController capability interface so that users can enable or disable network access for a device that is connected to a home network controller. You can enable and disable internet and network access on both Wi-Fi and Ethernet connections, without removing devices from the Wi-Fi network. You can also use AccessController to schedule access to the network. For an overview of the Alexa networking API, see Understand Networking and Wi-Fi Skills.

Before you test a skill that uses the AccessController interface, add a device to the network in the Alexa app. For more information, see Overview of Wi-Fi Skills.

For the list of locales that are supported for the AccessController interface, see List of Capability Interfaces and Supported Locales.

Utterances

When you use the Alexa.Networking.AccessController interface, the voice interaction model is already built for you. The following examples show some customer utterances:

Alexa, pause Wi-Fi for John's tablet.
Alexa, pause internet for Jane's computer.
Alexa, enable the Wi-Fi for Junior's tablet for thirty minutes.
Alexa, enable the internet for Junior's phone for three hours.

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

Properties

The Alexa.Networking.AccessController interface uses the networkAccess property to represent whether an endpoint can connect to the network. The following are the valid network access values:

Value Description
ALLOWED The endpoint can connect to the network.
BLOCKED The endpoint cannot connect to the network.

The Alexa.Networking.AccessController interface uses the schedule property to represent when network access should be enabled or disabled, and for how long. The schedule property is expressed as a TimeInterval. If the user doesn't specify a schedule, enable or disable network access immediately.

Discovery

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

Set retrievable to true for all of the interfaces and properties that you report when Alexa sends your skill a state report request.

The friendlyName field is optional for this interface. If the user sets a name for a device in your app, then provide that name in your discover response; otherwise, don't include friendlyName.

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

In addition to the usual discovery response fields, for AccessController, include a configuration object that contains the following fields.

Field Description Type Required
supportsScheduling If true indicates that the user can schedule network access for the endpoint. Boolean No

Discover response example

The following example shows a Discover.Response message for a mobile phone endpoint that supports the ConnectedDevice and AccessController interfaces.

{
  "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": "<the friendly name of the endpoint, optional for this interface>",
          "displayCategories": ["MOBILE_PHONE"],
          "cookie": {},
          "relationships": {
            "isConnectedBy": {
              "endpointId": "<unique ID of the home network endpoint>"
            }
          },
          "capabilities": [
            {
              "type": "AlexaInterface",
              "interface": "Alexa.Networking.ConnectedDevice",
              "version": 3,
              "configuration": {
                "firstConnectionTime": "2018-05-30T08:15Z",
                "staticDeviceInformation": {
                  "deviceName": "Personal cell phone",
                  "hostname": "Pixel XL",
                  "brand": "Google",
                  "model": "Pixel XL",
                  "operatingSystem": "Android 10",
                  "macAddress": "00:09:5B:EC:EE:F2",
                  "dhcpFingerprint": "1,15,3,6,44,46,47,31,33,249,43",
                  "dhcp6Fingerprint": "1,15,3,6,44,46,47,31,33,249,43,252,12"
                }
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa.Networking.AccessController",
              "version": "3",
              "properties": {
                "supported": [
                  {
                    "name": "networkAccess",
                    "name": "schedule"
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "supportsScheduling": true
              }
            },
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            }
          ]
        }
      ]
    }
  }
}

Directives

SetNetworkAccess directive

Support the SetNetworkAccess directive so that customers can enable or disable network access for a device.

The following examples show customer utterances:

Alexa, paus Wi-Fi for John's tablet.
Alexa, enable the Wi-Fi for Junior's tablet for thirty minutes.

SetNetworkAccess directive payload details

Field Description Type
networkAccess Whether to enable or disable network access; one of ALLOWED or BLOCKED. String
schedule The time and duration to enable or disable network access. If schedule is omitted, enable or disable network access immediately. You identify whether you support scheduling in your discover response. A TimeInterval object.

SetNetworkAccess directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Networking.AccessController",
      "name": "SetNetworkAccess",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>",
      "cookie": {}
    },
    "payload": {
      "networkAccess": "BLOCKED",
      "schedule": {
          "duration": "PT30M"
      }
    }
  }
}

SetNetworkAccess response event

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

SetNetworkAccess response event example

The following example shows a response to a SetNetworkAccess directive.

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
        "namespace": "Alexa.Networking.AccessController",
        "name": "networkAccess",
        "value": "BLOCKED",
        "timeOfSample": "2019-10-15T14:15:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Networking.AccessController",
        "name": "schedule",
        "value": {
          "start":"2019-10-15T14:00Z",
          "end":"2019-10-15T14:30Z"
        },
        "timeOfSample": "2019-10-15T14:15:00Z",
        "uncertaintyInMilliseconds": 0
      }
    ]
  }
}

SetNetworkAccess directive error handling

If you can't handle a SetNetworkAccess 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 of the retrievable properties in the context object. You identify your retrievable properties in your discovery response. For more information about state reports, see Understand State Reporting.

StateReport response event example

{
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "StateReport",
      "messageId": "<message id>",
      "correlationToken": "<an opaque correlation token>",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type": "BearerToken",
        "token": "<an OAuth2 bearer token>"
      },
      "endpointId": "<endpoint id>"
    },
    "payload": {}
  },
  "context": {
    "properties": [
      {
        "namespace": "Alexa.Networking.AccessController",
        "name": "networkAccess",
        "value": "BLOCKED",
        "timeOfSample": "2019-10-15T14:15:00Z",
        "uncertaintyInMilliseconds": 0
      },
      {
        "namespace": "Alexa.Networking.AccessController",
        "name": "schedule",
        "value": {
          "start":"2019-10-15T14:00Z",
          "end":"2019-10-15T14:30Z"
        },
        "timeOfSample": "2019-10-15T14:15: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 more information about change reports, see Understand State 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": "APP_INTERACTION"
        },
        "properties": [
          {
            "namespace": "Alexa.Networking.AccessController",
            "name": "networkAccess",
            "value": "ALLOWED",
            "timeOfSample": "2019-10-15T14:20:00Z",
            "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {}
}