感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Understand Networking and Wi-Fi Skills

You can use the Alexa.Networking APIs to create Alexa skills that model a home Wi-Fi network and the devices connected to it, such as computers and mobile phones. Your skill can enable and disable internet and network access for individual devices on both Wi-Fi and Ethernet connections, and schedule access duration.

You can enable and disable internet and network access on both Wi-Fi and Ethernet connections, without removing devices from the Wi-Fi network.

Utterances

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

Alexa, turn off the Wi-Fi for John's tablet.
Alexa, enable the internet for Junior's phone for three hours.

Overview of Wi-Fi Skills

The user can only voice-control network access for the devices they choose in the Alexa app. In the Alexa app, choose Devices, choose Wi-Fi access, and then select the devices that you want to voice-control on the network.

By using relationships, users can associate multiple connected devices with a single home network controller. If the user deletes a home network, all the connected devices are also deleted. You report relationships during discovery for connected devices. For more information, see connected devices discovery.

If your device is a router, advertise your service by using DNS-based service discovery to help Alexa discover your router locally. If Alexa can discover your router, Alexa publishes a card in the Alexa app to help customers set up voice-control networking for your router. For more information, see DNS-based service discovery.

You create networking and Wi-Fi skills the same way you create any other smart home skill. For more information, see Understand the Smart Home Skill API and Steps to Build a Smart Home Skill.

Alexa.Networking interfaces

The following are the available Alexa.Networking interfaces.

Alexa.Networking.HomeNetworkController
The HomeNetworkController interface is an abstract representation of a home network, and represents an IP network router.
Alexa.Networking.ConnectedDevice
Implement the ConnectedDevice capability interface for devices that connect to a home network controller.
Alexa.Networking.AccessController
Implement the AccessController interface so that users can enable or disable network and internet access for a device. You can also use AccessController to schedule access to the network.

DNS-based service discovery

If your device is a router, advertise a multicast service, by using rfc6763 DNS-based service discovery. We recommend that you use Avahi or Bonjour software, or any other standards-compliant software implementation of DNS service discovery. In your DNS service discovery, the service type is _alexa._tcp, and the domain is local.

Provide the following information in your DNS service discovery records.

Record Field Value
SRV hostname An rfc2782-compliant hostname. We recommend that you publish a multicast DNS entry that points to the router itself.
TXT skillSetupId A UUID provided by Amazon, for information required to set up your skill. You request a skillSetupId by emailing alexa-homenetworking@amazon.com. In your email, provide the brand name of your appliance and the ID of your skill.
TXT version The version of the TXT schema. The current version is 1.

Example service discovery

The following example uses the built-in DNS service discovery client on macOS. Using the following command:

dns-sd -Z _alexa._tcp local

The following is the correct resolution:

_alexa._tcp          PTR  example._alexa._tcp
example._alexa._tcp  SRV  0 0 443 186590d00737-2.local.
example._alexa._tcp  TXT  "version=1" "skillSetupId=114980c4-62fb-4ec3-801e-a6ac42c1b901"