Alexa.Networking.AccessController Interface 3


Implement the Alexa.Networking.AccessController interface in your Alexa skill 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 Alexa.Networking.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 Alexa.Networking.AccessController interface, make sure you use the Alexa app to add a device to the network you're testing with. For more details, see Overview of Wi-Fi Skills.

For the list of languages that the Alexa.Networking.AccessController 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.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.

Reportable 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 field in the SetNetworkAccess directive to represent when network access should be enabled or disabled, and for how long. This field 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 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, 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 that supports the Alexa.Networking.ConnectedDevice and Alexa.Networking.AccessController 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": "Your device name, displayed in the Alexa app, 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",
                  }
                ],
                "proactivelyReported": true,
                "retrievable": true
              },
              "configuration": {
                "supportsScheduling": 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.Networking.AccessController interface directives to your skill.

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 example

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

{
  "directive": {
    "header": {
      "namespace": "Alexa.Networking.AccessController",
      "name": "SetNetworkAccess",
      "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": {
      "networkAccess": "BLOCKED",
      "schedule": {
          "duration": "PT30M"
      }
    }
  }
}

SetNetworkAccess directive payload

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 response

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.

The following example shows a SetNetworkAccess response.

The following example shows a response to a SetNetworkAccess 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.Networking.AccessController",
        "name": "networkAccess",
        "value": "BLOCKED",
        "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 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.Networking.AccessController",
        "name": "networkAccess",
        "value": "BLOCKED",
        "timeOfSample": "2019-10-15T14:15: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": "APP_INTERACTION"
        },
        "properties": [
          {
            "namespace": "Alexa.Networking.AccessController",
            "name": "networkAccess",
            "value": "ALLOWED",
            "timeOfSample": "2019-10-15T14:20:00Z",
            "uncertaintyInMilliseconds": 0
          }
        ]
      }
    }
  },
  "context": {
    "namespace": "Alexa.EndpointHealth",
    "name": "connectivity",
    "value": {
      "value": "OK"
    },
    "timeOfSample": "2019-10-15T14:20:00Z",
    "uncertaintyInMilliseconds": 0
  }
}

Was this page helpful?

Last updated: Mar 01, 2024