WWDC2017 Session 705

Transcript

[ Applause ]
>> Thank you.
Welcome everybody.
Good morning.
It's early.
I hope you had your coffee.
We have a lot to talk about
today.
Welcome to what's new in
HomeKit.
In iOS 11, watchOS 4 and tvvOS
11.
We have a ton of great features
and enhancements we'd like to
talk to you today about.
First, we will be providing an
overview of HomeKit as a
framework.
Second, we're going to be
talking about some of the
updates and enhancements to the
HomeKit framework in iOS 11.
And Praveen will be sharing some
exciting news about our
accessory ecosystem.
The HomeKit framework allows
your apps to easily set up and
control your HomeKit
accessories.
HomeKit provides a central store
for the configuration of your
home, including rooms,
accessories, automations and
more.
This configuration is
synchronized across all of your
apps and devices.
And HomeKit is deeply integrated
in iOS, Watch OS and TV OS.
You can control your accessories
and scenes directly with your
voice, using Siri, or using the
Home app, you can control all of
your accessories from any of
your devices.
And with just a swipe and a tap,
you can control your favorite
scenes and accessories right
from Control Center, and it has
really never been easier for you
to control your home.
And with an Apple TV or iPad as
your Home Hub, you can control
your accessories from just about
anywhere in the world.
And we are happy to say that in
addition to being a fantastic
speaker, the Home Pod will also
be added as a Home Hub later
this year.
And with a compatible home hub,
your home can be automated via
time and event-based triggers.
And with over 70 accessory
manufacturers, either bringing
accessories to market or already
have accessories on the market,
the number of HomeKit
accessories continues to grow
month over month.
It is super exciting.
We have a number of new features
to talk about in iOS 11 and
today we are going to focus on
event triggers.
Today, I'm happy to say that we
are introducing New Events, New
Conditions, support for End
Events, and Recurrences.
And finally we are talking about
the enhancement for Mutable
Events.
But before we dive into what is
new, I'd like to do a quick
overview of Event Triggers.
Event Triggers center around
events.
When an event fires, it
activates a trigger, and you can
have one or more events
associated to an event trigger.
We support two different types
of events today.
The first, when the state of an
accessory changes, such as
opening of a door, or turning on
a light.
Second, we support when a device
enters or leaves a geo region.
And when an event fires, and the
event trigger activates, it
executes one or more scenes.
And a scene is comprised of one
or more actions, such as
unlocking my door, or turning on
my lights.
And you can gate the execution
of a scene when a trigger is
activated via conditions.
And we support a number of
different types of conditions.
First, based on the current
time.
Second, based on the current
state of an accessory.
Excuse me.
And last, based on the relative
time to significant events, such
as sunrise and sunset.
Now, as an example, When we
arrive home and we open our
door, and in this case, opening
the door is our event.
And after dark, this is our
condition.
And it is based on a significant
event of sunset.
We want to say execute our
arrive home scene.
And that is an event trigger.
And we have a number of
enhancements and new features
for event triggers.
The first of which is support
for date-based events, via
HMCalendarEvent.
This provides an improved
scheduling capability over HM
timer triggers.
You can now take advantage of
all the features of the
triggers, such as conditions,
and some of the other features
we are going to be talking about
shortly.
And we support dates based on
year, month, day, and hour
minute combination.
Now, as an example, let's go
ahead and create an event
trigger which executes at 5:30
p.m. every day.
First, we are going to create
our date component.
In this case, we are going to
set two properties, the hour
property to 17, indicates 5:00
p.m. Second, we are going to set
the minute property to 30, and
this indicates 30 minutes after
5:00 p.m. We then simply create
our HMCalendarEvent, and we
specify our recently created
date component.
Now, we have just created an
event which will fire at 5:30
every day.
We then simply create our
HMEventTrigger, and we're going
to give it a friendly name.
In this case, we are going to
call it Every day at 5:30 p.m.,
and then we specify our
collection of events.
In this case, a single event,
our HMCalendarEvent.
And now, in iOS 11, it is that
easy to create event-based
triggers based on times of the
day or specific dates.
We have also added support for
significant time events, via
HMSignificantTimeEvent.
This activates on significant
events, such as sunrise, and
sunset.
And we support a relative time
offset to these significant
events, both positive and
negative.
And this means you can schedule
events to fire, say one hour
after sunrise.
Now, let's go ahead and create
another event trigger.
This time, we want it to fire at
sunrise every day.
There we go.
First, we create our
HMSignificantTimeEvent, and we
are going to specify sunrise as
our significant event.
And we also specify our offset
to be nil.
Now, this indicates that we want
our event to fire at sunrise,
not before, and not after.
We then simply create our
HMEventTrigger, same as we did
before, and we specify this time
our sunrise event as a single
firing event.
We've also added a convenience
to iOS 11 to allow you to easily
create a condition which is
between two significant events,
and note, that because these
take significant events, they
support a relative time offset.
So, for instance, I can create a
condition which gates the
execution of my scene from say
one hour after sunset, to one
hour before sunrise.
This is available on
HMEventTrigger via predicate for
evaluating trigger occurring
between significant events.
In iOS 11, we have also added
support for creating a event
which executes when a
characteristic value crosses a
threshold value.
Now, for example, we could
execute when the temperature
rises above 76 degrees in our
home.
We could also execute when the
temperature drops below 68
degrees in our home.
And finally, we could execute
when the temperature is between
68 and say 76 degrees in our
home.
Now, let's go ahead and build an
example.
We want to create an event
trigger which executes when the
temperature in our home rises
above 76 degrees.
To do this, we first create an
HMNumberRange.
Now, note, HMNumberRange is what
specifies our range between a
minimum and maximum value.
And we have provided two
convenience initializers for you
to create a range within a
minimum or a maximum value only.
In this case, we are providing
the minimum value to be 76.
And our maximum value in this
case is an arbitrary large
number, let's say it is positive
infinity.
We then create our HM
Characteristic Threshold Range
Event.
And we specify our target
characteristic.
In this case, it is a
temperature characteristic,
which can be a temperature
sensor, or it can be a
thermostat.
We then simply provide our
threshold range, which was our
recently created range of 76
degrees.
We then, as we've done before,
create our HMEventTrigger, and
this time, we specify our single
firing event, which is our
characteristic threshold range
event.
There we go.
Now, the state of our homes are
often tied to whether or not
users are in or out of the home.
For instance, I don't like to
run my air conditioning or have
lights on in my home when no one
is home.
I am happy to say that in iOS
11, this is now supported via
HMPresenceEvent [applause].
It is super cool.
You are going to love it.
We support a number of different
types of events.
Excuse me.
There we go.
First, when the current user,
that is the device that we are
talking about, arrives home.
On the other hand, we can also
support when the current user
leaves home.
Now, these two replace, or don't
replace, but they augment
HMLocationEvents, but instead of
tracking a single device, they
now track a user.
We've also added support for
multiple users of the home, in
fact, all users of the home.
For instance, we support when
the last user leaves home.
Now note, this indicates that
your home is now unoccupied.
It is a good time to do things
such as turn off the lights,
turn down the air conditioning,
even lock the doors.
And finally, of course, we
support when the first user
arrives home.
And this indicates that your
home is now occupied, and in
this case, it may be good for
you to do things like turn down
the air conditioning, turn on
some lights, unlock the doors.
Now, let's go ahead and build
this last example, where we
create an event trigger which
executes when the first user
arrives home.
First, we create our
HMPresenceEvent, and we are
going to specify our presence
type to be any user at home.
Now, this indicates that we want
our event to fire when the first
user arrives home.
We then, just as we have done
before, create an
HMEventTrigger, and we specify
our single firing event, in this
case, which is our presence
event.
And you probably know what I am
going to say, but it really is
that easy in iOS 11 to create
user presence based automations,
and it is super cool, and we are
super excited for you to try it
out, and provide some enhanced
features to your client, or your
app users, excuse me.
Now, we didn't stop there.
We have also added support for
user presence conditions.
Now, for example, let's say that
normally we want to execute our
good morning scene when we wake
up, or when the sun rises.
But it doesn't make sense for us
to execute this if no one is
home.
In iOS 11, you can now gate the
execution of scenes based on
user presence via user presence
conditions.
This is available on
HMEventTrigger via predicate for
evaluating trigger with
presence.
And note that it takes a
presence event.
Now, let's go ahead and add a
presence condition to our
previous sunrise event trigger
and take a look at what it looks
like.
First, we are going to create
our significant time event,
which is our sunrise event,
specifying no offset, same as we
did before.
We then create our
HMPresenceEvent, again same as
we did before, specifying any
user at home.
We then create our condition via
HMEventTrigger, predicate for
evaluating trigger with
presence, and we specify our
presenceEvent.
And then we create our
HMEventTrigger.
Now, this time, we are going to
specify our condition as the
predicate for the event trigger.
And now, and now we have just
created an event trigger which
will fire every day at sunrise,
but will only execute the
associated scenes when there is
a user at home.
If you're like me, we often want
to execute a trigger, but only
temporarily.
For instance, when I open my
patio door at night, I want my
patio light to turn on, but
after say 10 minutes, I want my
patio light to turn off
automatically.
And this is now possible in iOS
11 via EndEvents
[ Applause ]
.
EndEvents are available on
HMEventTrigger, and they return
a collection of HMEvents.
And you can update the existing
events or EndEvents for an event
trigger via update end events
with completionHandler.
Now, we have added a new event
for EndEvents.
HMDurationEvent.
This allows you to specify a
time interval from the trigger's
execution time, at which point
to end the event.
Now, on a similar note, we often
want a trigger to execute only
on certain days of the week, and
this is now possible via
Recurrences.
Recurrences are available on
HMEventTrigger, and they return
an optional collection of date
components which specify the
days of the week for which the
trigger is active.
And you can update an existing
event trigger with new
occurrences via Update
Recurrences with
completionHandler.
Now, as an example, I like to
get up just a little later on
the weekends, as I'm sure many
of you do.
So I don't want my Good Morning
Scene to automatically execute
an hour after sunrise.
Instead, I'd like to use Siri to
go ahead and say, "Good
morning."
So let's go ahead and gate our
previous sunrise event trigger
to only execute during the week,
Monday through Friday.
To do this, we create our
HMSignificantTimeEvent, same as
we did before.
Then we create our collection of
DateComponents.
We are going to call these
weekdays, then for each day of
the week, Monday through Friday,
we create a new DateComponent,
and we specify the weekday
property to be the current day
of the week, then we simply add
this to our weekdays collection.
And then when we create our
HmeventTrigger, we specify our
collection of recurrences, which
are date components, as
recurrences are of our
EventTrigger.
And this allows us to restrict
the execution of event triggers
based on the day of the week.
But furthermore, we also
sometimes want to create an
event trigger which only
executes once, and then auto
disables itself.
This is now possible via Execute
Once.
As an example, you may want to
create an event trigger that
executes tomorrow at sunset, but
you don't want it to repeat.
It is a great feature, and we
are excited for you to try it
out.
This is available on
HMEventTrigger via the Execute
Once property, and you can
update an existing or new event
trigger to only execute one time
via update executeOnce with
completionHandler.
The last, we've heard your
feedback and we understand how
difficult it currently is to
update existing events on an
event trigger.
Let's take an example.
If you were building an app and
updating a single event, you
first had to copy the properties
of that event in your
application, then you had to
allow the user to modify that
event.
Once the user completed their
changes, you had to create a
brand new HMEvent with the new
properties then you had to
remove the existing event, via
removeEvent with
completionHandler.
And then add the new event via
addEvent with completionHandler.
And this is a number of steps to
update just one single event.
And so in iOS 11 we have made it
simpler via a single method
updateEvents with
completionHandler.
Now this takes a collection of
HMEvents which represent the new
events for an event trigger.
And we have also added support
for all defined HMEvents for
mutable copies.
So what does this mean?
You can now simply take a
mutable copy of an existing
event, make any changes the user
has requested, and then commit
those changes via updateOnce
with completionHandler.
Let's go ahead and see an
example of updating our previous
sunrise event trigger to execute
30 minutes after sunrise.
First, we get our existing
HMEvent.
We are going to-this will return
an object of type
HMSignificantTimeEvent.
We then simply create a
mutableCopy, which will return
an object of type
HMMutableSignificantTimeEvent.
We can then update the offset of
our sunrise event, by creating a
new Date Component.
We specify the minute property
to 30, to indicated 30 minutes
after the significant event, and
then simply update the offset of
our mutableSunriseEvent to our
new date component.
Now note, we haven't actually
changed our event trigger yet.
It will still execute at
sunrise.
So move our event trigger to 30
minutes after sunrise, we simply
need to call UpdateEvents, with
completionHandler, providing a
collection of new events.
In this case, we simply pass our
single mutableSunriseEvent.
And now in iOS 11, it is that
easy for your apps to update
existing events on an
HMEventTrigger.
We've covered a tone of new
topics and enhancements to
HMEventTriggers.
First, we have added support for
new events, supporting dates.
Significant events,
characteristic threshold range,
and user presence.
We have added new conditions,
supporting significant time
ranges and user presence.
We have added support, excuse
me, for end events, which allow
you to specify temporary event
triggers which can
auto-deactivate after a
specified amount of time.
We've added support for
recurrences which allow you to
specify when your event trigger
will be active and finally, we
have added support for mutable
events for all defined event
types, which makes it easier for
your applications in iOS 11 to
update existing HMEventTriggers.
And now, I'd like to hand it off
to Praveen, to give you some
exciting updates about our
accessory ecosystem.
Praveen?
[ Applause ]
>> Thanks Matt.
Good morning everyone.
My name is Praveen Chegondi, and
I am here to share with you new
protocol features and
enhancements that are in iOS 11.
I have a few exciting topics to
talk about today.
I am going to be sharing some
great news about what we are
doing with the HomeKit accessory
protocol specification.
I am also going to be talking
about enhancement to the HomeKit
accessory protocol.
Supportive new accessory
categories in iOS 11.
Addition to the authentication
process for HomeKit accessories.
And finally, we will be rounding
up with improvements to the
self-certification process for
our MFi licensees.
Let's start off with a quick
overview of the HomeKit
Accessory Protocol
Specification.
The HomeKit Accessory Protocol
Specification describes how a
controller, which is an Apple
device, communicates with an
accessory, along with the
security requirements.
All sessions between Apple
devices and accessories over
HomeKit are end-to-end encrypted
and mutually authenticated.
The specification provides
implementation details for both
IP and Bluetooth LE accessories.
And you can also get details on
how to describe each of the
accessory categories that are
supported in HomeKit, such as a
light bulb, fan, thermostat, and
many, many more.
For complete overview of the
HomeKit accessory protocol, you
can refer to the 2014 session,
Designing Accessories for iOS
and OS X.
Until now, the specification was
available to MFi licensees,
whose accessories carried the
logo "works with Apple HomeKit"
after completing
self-certification.
Starting today, we are also
making a version of the HomeKit
Accessory Protocol Specification
available to anyone with a
developer license
[ Applause ]
.
So, if you are a student
developer, or even a hobbyist,
and want to learn about HomeKit
protocol and want to create
accessories for your personal
use, you can now do that
[applause].
The HomeKit developer page has
been updated with the
specification, and also you will
find other useful information,
such as frequently asked
questions, and guidelines to
building your HomeKit apps.
Because the specification has
Apple's proprietary information,
you will need to agree to a
click-through license before
downloading it.
And with all this information,
we are looking forward to seeing
what new ideas you're going to
come up with.
And let's say you come up with a
really cool prototype?
And now, you want to develop a
HomeKit accessory for commercial
sale.
You need to join the Apple MFi
Program.
You need to join the Apple MFi
Program and go through
self-certification before you
can begin your manufacturing or
sale of your accessories.
And this is really exciting.
And I recommend that you check
the developer page often for the
latest updates, as we continue
to introduce new features and
enhancements to the
Specification.
Talking about enhancements.
In iOS 11, we made some great
enhancements to the HomeKit
Accessory Protocol.
Now, let's see how a user with
iOS 10 sets up a HomeKit
Accessory, such as a light bulb.
These of course on the
accessory, by putting the light
bulb in the socket, chooses the
accessory from the add accessory
option in the Home, and scans
the eight digit setup code.
In three easy steps, the user is
able to set up a HomeKit
Accessory that is simple and
great.
A couple of things to note in
this process.
The accessory must be powered on
for it to show up.
Secondly, the setup code is used
for the initial HomeKit pairing
only, and this is to ensure that
you and only you are setting up
the accessory.
For many accessories that are
installed in hard to reach
places, such as a light bulb, or
have set up codes printed on the
back of the product, it makes it
difficult to scan the setup code
when it is powered on.
Or even choosing an accessory
when you are setting up multiple
accessories of the same model
becomes challenging.
In iOS 11, we are introducing
enhanced set of process to
further simplify accessory
setup.
With the enhanced setup, users
can now scan the setup code, and
then power on the accessory.
To achieve this, we are
enhancing the setup payload to
include setup ID in addition to
the setup code.
iOS 11 uses the setup ID to
start the pairing process with
the accessory when the setup
code is scanned, and matches to
the accessory when it is powered
on.
It is that simple.
To deliver the enhanced setup
code, we are now supporting
scanning of QR codes for setting
up HomeKit accessories
[ Applause ]
.
The QR code is standards based
and can be as small as 10 by 10
millimeters.
That is pretty small.
The small form factor of the QR
code will help a lot of
manufacturers to put the QR code
on the smaller accessories, and
this is really great.
But we didn't stop there.
We took one step further, and in
addition to supporting QR code,
we also added support for NFC
tags.
[ Applause ]
>> And we are really excited
about this.
With NFC tags that are
programmed with the Enhanced
Setup Code, we can now deliver
even more seamless user
experience for setting up
accessories.
The user needs to just tap to
pair and it is that simple, and
it is fantastic.
The whole experience in setting
up accessories in iOS 11 with
the support of QR code or NFC
tag for HomeKit Accessories is
just fantastic.
Now, let's talk about Bluetooth.
Over the last few years, we have
seen an influx of Bluetooth LE
HomeKit Accessories.
This is because Bluetooth LE
Accessories offer a lot of
advantages.
They are small, they are
extremely low power, and many
are battery operated, such as a
contact sensor, motion sensor,
and many more, and users use
these to trigger events when a
certain action takes place.
And this is really great.
Now, let's see how Bluetooth
notifications work in iOS 10.
In iOS 10, when an accessory
state changes, it triggers a
state change notification.
The home of apple TV in this
case picks up the state change,
and then establishes a
communication, a secure
communication with the accessory
to determine what state has
changed, and then triggers the
automation.
The whole process results in a
few seconds of latency for the
automation to be executed.
In iOS 11, we changed the
mechanism completely to
significantly reduce latency,
and we are doing this by what we
call Secure Broadcast Session to
send the notification.
Here, the iOS controller
configures the accessory with an
encryption key, and the
interested characteristics that
can be included in the secure
broadcast notifications.
Now, when a characteristic
changes, the accessory encrypts
the state change, and then sends
a notification to the Home app,
which will then immediately
execute the automation.
With this enhancement, we are
seeing a number of accessories
where the latency has gone from
a few seconds to under a second
for the events to be triggered.
And the best part about this
enhancement is that you just
need to upgrade to iOS 11 and
get new form ware for your
accessories to ensure faster,
because you don't need to buy
new products
[ Applause ]
.
And with the new event triggers
Matt talked about earlier, and
with secure broadcast
notifications for Bluetooth LE
accessories, it's just
incredible how home automation
is going to be defined now.
Coming to accessory categories.
HomeKit supports a wide range of
accessory types from sensors, to
cameras and many more.
Every year, we continue to add
supportive new accessory
categories.
This year, in iOS 11, we are now
adding support for sprinklers
and faucets
[ Applause ]
.
With the support of sprinklers
in HomeKit, users can now
control watering the garden by
Siri.
Somewhat in a similar accessory
category type, which is water
related, let's talk about
faucets.
For many users, it is a daily
ritual to turn on the shower,
let the water run, and wait for
the water to turn to the right
temperature before you get in
the shower.
Now, while having your morning
cup of coffee, you can let Siri
know it's bath time, and by the
time you finish your cup of
coffee, the water temperature is
just right to your desired
setting, and this can be
achieved with the faucets
accessory category.
That's pretty neat
[ Applause ]
.
Let's talk about authentication
now.
At Apple, security and quality
is of utmost importance to us.
Our customers trust that their
accessories are tested
thoroughly by MFi licenses and
audited by Apple.
To ensure accessories are
trusted and self-certified, we
have adopted hardware-based
authentication.
Starting with iOS 11, we are now
introducing an alternate method
to authenticate HomeKit
Accessories.
Now, accessories can be
authenticated by software
[ Applause ]
.
This provides a great option to
enable HomeKit and shipping
accessories that can be upgraded
to HomeKit.
For our MFi licensees, we will
be sharing more information
about the implementation later.
Continuing on the topic of
accessory quality, we now have
new and improved process and
tools to help MFi licensees
access the launch of HomeKit
Accessories.
We now have automated tools to
test your accessory and continue
to automate more and more test
cases, and we urge all MFi
licensees to always get the
latest tools before you begin
your testing.
Also, we are glad to announce
that we now have two Apple
authorized third-party labs here
in the United States, and
authorizing more third-party
labs in China, and UK next
month.
[ Applause ]
>> And this should help a lot of
MFi licensees to launch the
accessories sooner.
To recap the session, this year,
we introduced many compelling
and useful HomeKit features.
Matt talked about the great
enhancements to event triggers,
and introduced new APS you can
adopt in your apps to redefine
home automation.
I shared news about HomeKit
Accessory Protocol
Specifications being made
available to all developers.
And enhanced accessory setup
process makes it even better
than what it was before.
An interruption of secure
broadcast notifications for
Bluetooth LE accessories will
make the event triggers go
faster.
And introduced new accessory
categories, Sprinklers and
Faucets.
And finally, we provided an
update on automation tools for
self-certification and
authorizing third party labs
around the world to accelerate
the launch of HomeKit
Accessories.
We at Apple are really excited
about all these features, and we
can't wait to see what you are
going to do with them.
A couple of important things
before we close the session.
We have two HomeKit labs for you
this week, where you can chat
with a number of HomeKit
engineers, who will be happy to
answer any questions that you
have with regards to your apps
and/or accessories.
We will also be demonstrating
some of the new features and
enhancements that we just talked
about that are introduced in iOS
11.
The first lab is right after
this session in Technology Lab
J.
Thank you very much for coming,
and enjoy the rest of your
conference.
[ Applause ]
>> See you in the lab.