SlideShare a Scribd company logo
1 of 21
Download to read offline
HomeKit Framework
Carlos Raventos
Martial Lienert
Produits MFi
Station météo
Caméras : Welcome, Presence
+ HomeKit
Thermostat
Healthy Home Coach
Plan
Finalité
Technologies impliquées, spécificités
Configuration initiale d’un accessoire
Contrôle
Retour d’expérience
Finalité
Concerne les accessoires de contrôle de la maison : Thermostats, Prises,
Interrupteurs, Ampoules, Fenêtres, volets, sensors, etc.
Coordonner et contrôler des accessoires de différents fabricants, avec :
➔Apps tierces iOS, watchOS, tvOS : Framework Homekit
➔Siri
➔Apple Home : automations
Technologies impliquées
Base de données partagée : iCloud (structure de la maison, nommage)
Clés cryptographiques partagées à travers iCloud Keychain
HomeKit Accessory Protocol : entre un contrôleur (iPhone, Apple TV) et un
accessoire (BLE, IP)
Framework : Découverte, contrôle, monitoring accessoires
Spécificités
Pas de compte utilisateur à créer
Pas de serveur tiers
Securité end to end:
➔Clés stockées seulement dans iOS et l’accessoire
➔Un seul master
Accès distant avec Apple TV et iPad
Hiérarchie de données
HMHome
HMRoom
HMAccessory
HMService
HMCharacteristic
Configuration initiale
WiFi
Créer/choisir une maison
Appairage Homekit
Créer/choisir une pièce
Nommer les services contrôlables
WiFi avant iOS 10 : EAWiFiUnconfiguredAccessoryBrowser
let externalAccessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser(delegate: self, queue: dispatch_get_main_queue())
externalAccessoryBrowser.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil)
// MARK: EAWiFiUnconfiguredAccessoryBrowserDelegate Methods
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFindUnconfiguredAccessories accessories:
Set<EAWiFiUnconfiguredAccessory>) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didRemoveUnconfiguredAccessories accessories:
Set<EAWiFiUnconfiguredAccessory>) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didUpdateState state:
EAWiFiUnconfiguredAccessoryBrowserState) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFinishConfiguringAccessory accessory:
EAWiFiUnconfiguredAccessory, withStatus status: EAWiFiUnconfiguredAccessoryConfigurationStatus) {
if status == .Success {
// store accessory name and proceed to add to HMHome
}
}
externalAccessoryBrowser.configureAccessory(accessory, withConfigurationUIOnViewController: self)
WiFi depuis iOS 10 : HMAccessoryBrowser
let accessoryBrowser = HMAccessoryBrowser()
accessoryBrowser.delegate = self
accessoryBrowser.startSearchingForNewAccessories()
// MARK: HMAccessoryBrowserDelegate Methods
func accessoryBrowser(browser: HMAccessoryBrowser, didFindNewAccessory accessory: HMAccessory) {
}
func accessoryBrowser(browser: HMAccessoryBrowser, didRemoveNewAccessory accessory: HMAccessory) {
}
var home: HMHome? = HMHomeManager().primaryHome
home?.addAccessory(accessory) { error in
if let error = error {
// handle error
} else {
// Once it's successfully added to the home, add it to the room that's selected.
}
}
Appairage HomeKit : HMAccessoryBrowser
Créer/choisir une pièce
//func home(home: HMHome, assignAccessory accessory: HMAccessory, toRoom room: HMRoom) {
home.assignAccessory(accessory, toRoom: room) { error in
if let error = error {
//displayError(error)
} else {
//update view
}
//}
Nommer les services
//func updateName(name: String, forAccessory accessory: HMAccessory) {
accessory.updateName(name) { error in
if let error = error {
//displayError(error)
} else {
//update view
}
//}
Observe Home Database updates
public protocol HMHomeManagerDelegate : NSObjectProtocol {
optional public func homeManagerDidUpdateHomes(_ manager: HMHomeManager)
optional public func homeManagerDidUpdatePrimaryHome(_ manager: HMHomeManager)
optional public func homeManager(_ manager: HMHomeManager, didAddHome: HMHome)
optional public func homeManager(_ manager: HMHomeManager, didRemoveHome: HMHome)
}
Observe Home Database updates
public protocol HMHomeDelegate : NSObjectProtocol {
optional public func homeDidUpdateName(_ home: HMHome)
optional public func home(_ home: HMHome, didAddAccessory: HMAccessory)
optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory)
optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory)
optional public func home(_ home: HMHome, didAddRoom: HMRoom)
optional public func home(_ home: HMHome, didRemoveRoom: HMRoom)
// (... a lot more)
}
Observe Home Database updates
public protocol HMHomeDelegate : NSObjectProtocol {
optional public func homeDidUpdateName(_ home: HMHome)
optional public func home(_ home: HMHome, didAddAccessory: HMAccessory)
optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory)
optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory)
optional public func home(_ home: HMHome, didAddRoom: HMRoom)
optional public func home(_ home: HMHome, didRemoveRoom: HMRoom)
// (... a lot more)
}
// Notifications are only received
// if the database is modified by
// another device/app !
Contrôle de l’accessoire
Actions possibles:
Lire une caractéristique
Ecrire une caractéristique
Ecouter les notifications
Créer des scènes (écritures groupées de caractéristiques)
Triggers (Réagir aux changements de valeur des caractéristiques)
Contrôle de l’accessoire
import HomeKit
var lightBulb: HMAccessory?
// Get the PowerState characteristic through the LightBulb service
let lightBulbOn = lightBulb?.services.first(where: { (service) -> Bool in
service.serviceType == HMServiceTypeLightbulb
})?.characteristics.first(where: { (characteristic) -> Bool in
characteristic.characteristicType == HMCharacteristicTypePowerState
})
Lecture d’une caractéristique
// func readValue(completionHandler completion: @escaping (Error?) -> Void)
// var value: Any? { get }
lightBulbOn?.readValue(completionHandler: { (error) in
if let error = error {
// Handle the error
} else if let isOn = lightBulbOn?.value as? Bool {
print("Light bulb is (isOn ? "ON" : "OFF")")
}
})
Ecriture d’une caractéristique
// func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void)
lightBulbOn?.writeValue(false, completionHandler: { (error) in
if let error = error {
// Handle the error
} else {
print("Light bulb is OFF")
}
})
Notifications
// func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void)
lightBulbOn?.enableNotification(true, completionHandler: { (error) in
if let error = error {
// Handle error
} else {
print("Notifications are enabled")
}
})
class AccDelegate : NSObject, HMAccessoryDelegate {
public func accessory(_ accessory: HMAccessory, service: HMService, didUpdateValueForCharacteristic: HMCharacteristic) {
if let isOn = characteristic.value as? Bool {
print("Light bulb is now (isOn ? "ON" : "OFF")")
}
}
}
let delegate = AccDelegate()
lightBulb?.delegate = delegate;

More Related Content

What's hot

Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node jsThomas Roch
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptjnewmanux
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptŁukasz Kużyński
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.jsMatthew Beale
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetCocoaHeads France
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsPiotr Pelczar
 
HomeKit Inside And Out
HomeKit Inside And OutHomeKit Inside And Out
HomeKit Inside And OutRolf Rando
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeRamon Ribeiro Rabello
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3Luciano Mammino
 
Javascript Promises/Q Library
Javascript Promises/Q LibraryJavascript Promises/Q Library
Javascript Promises/Q Libraryasync_io
 
React native-firebase startup-mtup
React native-firebase startup-mtupReact native-firebase startup-mtup
React native-firebase startup-mtupt k
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJSFestUA
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and httpAlexe Bogdan
 

What's hot (20)

Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe Converset
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
Map kit light
Map kit lightMap kit light
Map kit light
 
HomeKit Inside And Out
HomeKit Inside And OutHomeKit Inside And Out
HomeKit Inside And Out
 
Promise pattern
Promise patternPromise pattern
Promise pattern
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
 
Promises, Promises
Promises, PromisesPromises, Promises
Promises, Promises
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
 
Javascript Promises/Q Library
Javascript Promises/Q LibraryJavascript Promises/Q Library
Javascript Promises/Q Library
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 
React native-firebase startup-mtup
React native-firebase startup-mtupReact native-firebase startup-mtup
React native-firebase startup-mtup
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and http
 

Viewers also liked

Viewers also liked (20)

What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
 
Make Acccessibility Great Again
Make Acccessibility Great AgainMake Acccessibility Great Again
Make Acccessibility Great Again
 
Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3
 
L'intégration continue avec Bitrise
L'intégration continue avec BitriseL'intégration continue avec Bitrise
L'intégration continue avec Bitrise
 
La sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockLa sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de Bock
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
 
CloudKit as a backend
CloudKit as a backendCloudKit as a backend
CloudKit as a backend
 
Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?
 
Project Entourage
Project EntourageProject Entourage
Project Entourage
 
Rebranding an ios application
Rebranding an ios applicationRebranding an ios application
Rebranding an ios application
 
J'ai fait une app native en React Native
J'ai fait une app native en React NativeJ'ai fait une app native en React Native
J'ai fait une app native en React Native
 
Alamofire
AlamofireAlamofire
Alamofire
 
Design like a developer
Design like a developerDesign like a developer
Design like a developer
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
Handle the error
Handle the errorHandle the error
Handle the error
 
SwiftyGPIO
SwiftyGPIOSwiftyGPIO
SwiftyGPIO
 
Programme MFI retour d'expérience
Programme MFI retour d'expérienceProgramme MFI retour d'expérience
Programme MFI retour d'expérience
 
How to communicate with Smart things?
How to communicate with Smart things?How to communicate with Smart things?
How to communicate with Smart things?
 

Similar to Présentation de HomeKit

JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformRobert Nyman
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server IntegrationWO Community
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingHoat Le
 
A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015Matthias Noback
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...Robert Nyman
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Acquia
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaMobileNepal
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterHaehnchen
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdfdbaman
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBrian Sam-Bodden
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Using FakeIteasy
Using FakeIteasyUsing FakeIteasy
Using FakeIteasyDror Helper
 
MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2 MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2 PROIDEA
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...Wim Selles
 

Similar to Présentation de HomeKit (20)

JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server Integration
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
 
A First Date With Scala
A First Date With ScalaA First Date With Scala
A First Date With Scala
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan Gupta
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Using FakeIteasy
Using FakeIteasyUsing FakeIteasy
Using FakeIteasy
 
MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2 MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 

More from CocoaHeads France

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer FutureCocoaHeads France
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11CocoaHeads France
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeadsCocoaHeads France
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notificationsCocoaHeads France
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECocoaHeads France
 
Build a lego app with CocoaPods
Build a lego app with CocoaPodsBuild a lego app with CocoaPods
Build a lego app with CocoaPodsCocoaHeads France
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayCocoaHeads France
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiCocoaHeads France
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliCocoaHeads France
 

More from CocoaHeads France (12)

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer Future
 
iOS App Group for Debugging
iOS App Group for DebuggingiOS App Group for Debugging
iOS App Group for Debugging
 
Asynchronous swift
Asynchronous swiftAsynchronous swift
Asynchronous swift
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeads
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notifications
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANE
 
Super combinators
Super combinatorsSuper combinators
Super combinators
 
Build a lego app with CocoaPods
Build a lego app with CocoaPodsBuild a lego app with CocoaPods
Build a lego app with CocoaPods
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple Pay
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzki
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa Squalli
 

Recently uploaded

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 

Recently uploaded (20)

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 

Présentation de HomeKit

  • 2. Produits MFi Station météo Caméras : Welcome, Presence + HomeKit Thermostat Healthy Home Coach
  • 3. Plan Finalité Technologies impliquées, spécificités Configuration initiale d’un accessoire Contrôle Retour d’expérience
  • 4. Finalité Concerne les accessoires de contrôle de la maison : Thermostats, Prises, Interrupteurs, Ampoules, Fenêtres, volets, sensors, etc. Coordonner et contrôler des accessoires de différents fabricants, avec : ➔Apps tierces iOS, watchOS, tvOS : Framework Homekit ➔Siri ➔Apple Home : automations
  • 5. Technologies impliquées Base de données partagée : iCloud (structure de la maison, nommage) Clés cryptographiques partagées à travers iCloud Keychain HomeKit Accessory Protocol : entre un contrôleur (iPhone, Apple TV) et un accessoire (BLE, IP) Framework : Découverte, contrôle, monitoring accessoires
  • 6. Spécificités Pas de compte utilisateur à créer Pas de serveur tiers Securité end to end: ➔Clés stockées seulement dans iOS et l’accessoire ➔Un seul master Accès distant avec Apple TV et iPad
  • 8. Configuration initiale WiFi Créer/choisir une maison Appairage Homekit Créer/choisir une pièce Nommer les services contrôlables
  • 9. WiFi avant iOS 10 : EAWiFiUnconfiguredAccessoryBrowser let externalAccessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser(delegate: self, queue: dispatch_get_main_queue()) externalAccessoryBrowser.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil) // MARK: EAWiFiUnconfiguredAccessoryBrowserDelegate Methods func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFindUnconfiguredAccessories accessories: Set<EAWiFiUnconfiguredAccessory>) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didRemoveUnconfiguredAccessories accessories: Set<EAWiFiUnconfiguredAccessory>) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didUpdateState state: EAWiFiUnconfiguredAccessoryBrowserState) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFinishConfiguringAccessory accessory: EAWiFiUnconfiguredAccessory, withStatus status: EAWiFiUnconfiguredAccessoryConfigurationStatus) { if status == .Success { // store accessory name and proceed to add to HMHome } } externalAccessoryBrowser.configureAccessory(accessory, withConfigurationUIOnViewController: self)
  • 10. WiFi depuis iOS 10 : HMAccessoryBrowser let accessoryBrowser = HMAccessoryBrowser() accessoryBrowser.delegate = self accessoryBrowser.startSearchingForNewAccessories() // MARK: HMAccessoryBrowserDelegate Methods func accessoryBrowser(browser: HMAccessoryBrowser, didFindNewAccessory accessory: HMAccessory) { } func accessoryBrowser(browser: HMAccessoryBrowser, didRemoveNewAccessory accessory: HMAccessory) { } var home: HMHome? = HMHomeManager().primaryHome home?.addAccessory(accessory) { error in if let error = error { // handle error } else { // Once it's successfully added to the home, add it to the room that's selected. } }
  • 11. Appairage HomeKit : HMAccessoryBrowser
  • 12. Créer/choisir une pièce //func home(home: HMHome, assignAccessory accessory: HMAccessory, toRoom room: HMRoom) { home.assignAccessory(accessory, toRoom: room) { error in if let error = error { //displayError(error) } else { //update view } //}
  • 13. Nommer les services //func updateName(name: String, forAccessory accessory: HMAccessory) { accessory.updateName(name) { error in if let error = error { //displayError(error) } else { //update view } //}
  • 14. Observe Home Database updates public protocol HMHomeManagerDelegate : NSObjectProtocol { optional public func homeManagerDidUpdateHomes(_ manager: HMHomeManager) optional public func homeManagerDidUpdatePrimaryHome(_ manager: HMHomeManager) optional public func homeManager(_ manager: HMHomeManager, didAddHome: HMHome) optional public func homeManager(_ manager: HMHomeManager, didRemoveHome: HMHome) }
  • 15. Observe Home Database updates public protocol HMHomeDelegate : NSObjectProtocol { optional public func homeDidUpdateName(_ home: HMHome) optional public func home(_ home: HMHome, didAddAccessory: HMAccessory) optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory) optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory) optional public func home(_ home: HMHome, didAddRoom: HMRoom) optional public func home(_ home: HMHome, didRemoveRoom: HMRoom) // (... a lot more) }
  • 16. Observe Home Database updates public protocol HMHomeDelegate : NSObjectProtocol { optional public func homeDidUpdateName(_ home: HMHome) optional public func home(_ home: HMHome, didAddAccessory: HMAccessory) optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory) optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory) optional public func home(_ home: HMHome, didAddRoom: HMRoom) optional public func home(_ home: HMHome, didRemoveRoom: HMRoom) // (... a lot more) } // Notifications are only received // if the database is modified by // another device/app !
  • 17. Contrôle de l’accessoire Actions possibles: Lire une caractéristique Ecrire une caractéristique Ecouter les notifications Créer des scènes (écritures groupées de caractéristiques) Triggers (Réagir aux changements de valeur des caractéristiques)
  • 18. Contrôle de l’accessoire import HomeKit var lightBulb: HMAccessory? // Get the PowerState characteristic through the LightBulb service let lightBulbOn = lightBulb?.services.first(where: { (service) -> Bool in service.serviceType == HMServiceTypeLightbulb })?.characteristics.first(where: { (characteristic) -> Bool in characteristic.characteristicType == HMCharacteristicTypePowerState })
  • 19. Lecture d’une caractéristique // func readValue(completionHandler completion: @escaping (Error?) -> Void) // var value: Any? { get } lightBulbOn?.readValue(completionHandler: { (error) in if let error = error { // Handle the error } else if let isOn = lightBulbOn?.value as? Bool { print("Light bulb is (isOn ? "ON" : "OFF")") } })
  • 20. Ecriture d’une caractéristique // func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void) lightBulbOn?.writeValue(false, completionHandler: { (error) in if let error = error { // Handle the error } else { print("Light bulb is OFF") } })
  • 21. Notifications // func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) lightBulbOn?.enableNotification(true, completionHandler: { (error) in if let error = error { // Handle error } else { print("Notifications are enabled") } }) class AccDelegate : NSObject, HMAccessoryDelegate { public func accessory(_ accessory: HMAccessory, service: HMService, didUpdateValueForCharacteristic: HMCharacteristic) { if let isOn = characteristic.value as? Bool { print("Light bulb is now (isOn ? "ON" : "OFF")") } } } let delegate = AccDelegate() lightBulb?.delegate = delegate;