TONI KLOPFENSTEIN: Making It easy to set up
and configure smart devices in the home
helps create a more positive user experience.
Let's take a closer look at the flow for commissioning devices
through mobile.
JAMES ROMO: Let's take a look at the setup flow for a new matter
device in your Android app.
The initial step is for your app to initiate the Add New Device
flow, which will redirect to the Google Play Services
commissioning flow and starts by prompting the user
to scan the device QR code or a set up code.
If you already have this information,
it can be supplied as part of the commissioning request
data in which case this step will be skipped.
Once scanned, the user will be prompted
to connect the device to the user's Google account.
Google Play Services will connect the device
to Wi-Fi, ethernet and/or thread networks as applicable.
After the device successfully connects,
the user will be prompted to select the device
name and, optionally, location in their home.
Once the fields are submitted, the user
will be redirected from the Google Play Services,
provide UI back to your app.
Let's take a look at the full commissioning flow we just
walked through, which encompasses
the broadcasting of the device through the user setting,
the device name, and room.
As you can see, there are numerous interactions
between your app, Google Play Services, and the matter
device.
The initial step involves commission device
using the commissioning client, which can be obtained
from the matter entry point.
This can be retrieved either using a context or activity.
If the device being searched for is known,
it can be specified via the device info in the commission
request, and it will be set up during the commissioning
process.
Alternatively, if you already have
proof of possession of the device,
such as a manually-entered passcode or QR code,
you can provide this in the commissioning request
to target a specific device and bypass the need
to obtain this information from the user during commissioning.
To commission your own fabric, you
must provide an export implementation
of abstract commissioning service which
will be notified when the device is
ready to have your operational certificates installed
on the device.
The next steps involve establishing
proof of possession using a QR code
or a manually-entered code, commissioning the device
into Google Fabric, and connecting
to the operational network.
These steps are color coded and match up to the preview
flows shown above.
Everything will be provided out of the box by the Play Services
flow with no need for your app to do anything.
After connecting to the network, you'll
be able to commission your device into your fabric.
The onCommissioningRequest method
in your implementation of the abstract commissioning service
will be invoked.
And then manually pairing code will be provided to you
so that you can commission the device with your own fabric
credentials.
After you've completed your desired commissioning steps
and have issued a CommissioningComplete command
to your commission device, you must
call sendCommissionComplete to indicate success.
Alternatively, if something went wrong during your process,
you can call sendCommissioningFailure
to indicate the cause.
In the sendComissioningComplete response,
you can also supply a list of room names
and a suggested name for the device.
Both are optional and will be presented to your user
to choose from or modify.
The chosen name will be written to the basic information
cluster as the user label.
And the selected name and room, if any,
will be returned to the commissioning result.
Finally, the last step involves redirecting back to your app
with the commissioning result containing
the user-selected room and device name.
This commissioning result can be obtained from the intent sender
result via the CommissioningResult.fromIntent.
TONI KLOPFENSTEIN: To learn more about commissioning devices,
check out the resources linked below.
If you have any questions, or if you
want to see what everyone else is building, join us on Reddit
or follow us on Twitter.
Thanks for watching.