Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
日曜HackでHomeKitと戯れた話
Search
Tatsuya Tanaka
October 30, 2016
Technology
2.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
日曜HackでHomeKitと戯れた話
API非公開の学習リモコンをHomeKit対応させた話と、HomeKitについて。
@iOS_LT #23
Tatsuya Tanaka
October 30, 2016
More Decks by Tatsuya Tanaka
See All by Tatsuya Tanaka
iPhoneのセンサー情報をmacOSアプリでリアルタイム活用するための技術
tattn
1
820
Better use of SwiftUI
tattn
0
520
Swift Concurrencyによる安全で快適な非同期処理
tattn
2
1.5k
iOSアプリの技術選択2022
tattn
7
4.1k
Widget Suggestions 対応と ヤフーの新OS対応
tattn
1
1.4k
WidgetKitで良い体験を作るには / Good experience with WidgetKit
tattn
2
2k
既存アプリにSwiftUIをどう組み込んでいくか
tattn
8
2.6k
iOS 14からのアプリ内課金
tattn
5
3.2k
iOS 14の位置情報系アップデート
tattn
0
23k
Other Decks in Technology
See All in Technology
"AWSはちょっと苦手"でも大丈夫。AWS Blocks で手軽に作る Flutter のバックエンド #FlutterKaigi
tacck
PRO
0
140
攻撃 3 時間 vs 復旧 10 時間。アクセスキー流出の非対称性を体感するために CTF を作った話
kazzpapa3
1
140
続・ソフトウェアアーキテクトのための意思決定術: Decision Readiness, Revisited — When AI Changes the Economics of Software Architecture
snoozer05
PRO
5
1.3k
Content Mapper APIの応用例~CSS Modules、言語ファイル~
uhyo
2
570
新卒エンジニア、 介護士になる
ryu1013
1
680
1週間、Opus封印でお願いします
kintotechdev
1
460
Flutter Webを「SDK」として配る — 50以上のゲームを支える埋め込みアーキテクチャ
masayukisuda
0
180
kaonavi Tech Night#2
kaonavi
0
110
2026 Apache Flink Community Checkpoint
rmetzger
0
150
これだけは抑えておきたい!後悔しない re:Invent の過ごし方 / AWS re:Invent 2026 prestudy
kinunori
2
700
AIコーディングはじめました
miso
0
150
cdkd (CDK Direct)
gotok365
3
200
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
2
4.1k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
760
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
650
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
The browser strikes back
jonoalderson
0
1.9k
How GitHub (no longer) Works
holman
316
150k
The SEO Collaboration Effect
kristinabergwall1
1
610
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Testing 201, or: Great Expectations
jmmastey
46
8.4k
The SEO identity crisis: Don't let AI make you average
varn
0
630
The agentic SEO stack - context over prompts
schlessera
0
1k
Transcript
ాத ୡ (tattn) Github: https://github.com/tattn Qiita: http://qiita.com/tattn Twitter: https://twitter.com/tanakasan2525 ༵HackͰ
HomeKitͱٔΕͨ
HomeKit iOS 8 ͔Β͑ΔΑ͏ʹͳͬͨ iOSͱՈి Λܨ͙Ս͚ڮ
ઌिͷ༵ʹ͜Ε͕ಧ͖·ͨ͠ (ܹ҆ʂ2500ԁ) ֶशϦϞίϯϢχοτ
͔͠͠ɻɻɻ ͱ͍ͬͯ҆ͷͰ͕͢ APIެ։͞Εͯͳ͍ HomeKitʹରԠͯ͠ͳ͍
Demo
ಈըஏ͔͍ͣ͠ͷͰΧοτ
γεςϜߏ • RM mini 3 (ࠇ౾) • Node.js • homebridge
• iPhone 6s (iOS10) ࠇ౾ HomeKit API UDP ֎ઢ TV
ࠇ౾Λૢ࡞͢ΔͨΊʹ WireSharkͰެࣜΞϓϦͱࠇ౾ͷ௨৴Λݟͯɺ Node.jsͰͦΕΛਅࣅΔ͜ͱͰૢ࡞Մೳʹɻɻɻ
ࠇ౾Λૢ࡞͢ΔͨΊʹ ͪͳΈʹɺQUIC (ΫΠοΫ) ͱ͍͏ Google͕։ൃͨ͠৽͠ΊͷϓϩτίϧΛར༻͠ɺ UDPͷίωΫγϣϯΛு໋ͬͯྩΛग़ͯ͠·ͨ͠ɻɻɻʂ
Homebridge Node.jsͰHomeKitAPIͷΤϛϡϨʔτ͕Ͱ͖Δπʔϧ homebridge-***ͱ͍͏npmύοέʔδΛ࡞֦ͬͯு͢ΔΈɻ ࠇ౾༻ͷύοέʔδΛ࡞ɻ https://github.com/nfarina/homebridge https://github.com/tattn/homebridge-rm-mini3
iOS10ͰೖͬͨHomeΞϓϦ
ίʔυΛಡΈऔͬͯՈిΛઃఆ
͜Ε͚ͩͰɺHomeΞϓϦ & Siri ͔ΒϦϞίϯૢ࡞͕ՄೳʹͳΓ·ͨ͠ɻ
ୈࡾͷϖʔδ͕૿͑·ͨ͠
ͦ͏͍͑iOSͷLTͰͨ͠ɻɻɻ HomeKitͷAPIΛͬͯΈ·ͨ͠ https://github.com/tattn/HomeKit-Playground
HomeKitΛ͏ͨΊʹ CapabilityͰHomeKitΛOnʹ͢Δ
HomeKitͷઃఆͷΞΫηε plistʹ NSHomeKitUsageDescription ͷՃ͕ඞཁ iOS10͔ΒϢʔβʔσʔλͷΞΫηεͷ తͷهड़͕ඞਢʹ
ͱΓ͋͑ͣͷUI AppleͷΨΠυϥΠϯʹେମԊͬͨ ૉΒ͍͠UIΛ࡞ • ߇͑ΊͰ͋Δ͜ͱ • ໌ྎͰ͋Δ͜ͱ • Ԟߦ͖Λ༩͑Δ͜ͱ
Demo
ಈըஏ͔͍ͣ͠ͷͰΧοτ
HomeKit https://developer.apple.com/jp/documentation/HomeKitDeveloperGuide.pdf
Accessoryͷத (ྫ) https://developer.apple.com/jp/documentation/HomeKitDeveloperGuide.pdf TV Accessory Service • TV • εΠον
Characteristic • ిݯ • ϛϡʔτ • …
Primary Homeͷऔಘ // 管理クラスの取得 let homeManager = HMHomeManager() homeManager.delegate =
self // MARK: - HMHomeManagerDelegate func homeManagerDidUpdateHomes(_ manager: HMHomeManager) { // Primary Homeの取得 let home = manager.primaryHome } ↓͜ΕΛऔಘ
Room / Accessoryͷऔಘ let home = manager.primaryHome let room =
home?.rooms[0] let accessory = room?.accessories[0] // これでも可 let accessory = home?.accessories[0]
Characteristicͷऔಘ for service in accessory.services { switch service.serviceType { case
HMServiceTypeSwitch: for chara in service.characteristics { switch chara.characteristicType { case HMCharacteristicTypePowerState: // 電源スイッチの取得 chara default: () } } default: () } } Accessory Service • TV • Ϙλϯ Characteristic • ిݯ • ϛϡʔτ • …
ͷऔಘ Accessory Service • TV • Ϙλϯ Characteristic switch chara.characteristicType
{ case HMCharacteristicTypePowerState: // 値の取得 chara.readValue { error in let isOn = chara.value as? Bool } // 値の設定 chara.writeValue(true) { error in print(error) } default: () } • ిݯ • ϛϡʔτ • …
Έͳ͞Μͥͻ࡞Γ·͠ΐ͏ʂ APIͷ͜ͱΛΔͨΊʹ ۙʹͦͷٕज़Λײ͡Δͷ͕खͬऔΓૣ͍Ͱ͢ʂ ←ֶशϦϞίϯϢχοτ ɹ͓͢͢ΊͰ͢ʂ