Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What's new in HomeKitとNode-REDでカンタンHomeKitデバイスを...
Search
Shingo Tamaki
July 09, 2017
1
1.8k
What's new in HomeKitとNode-REDでカンタンHomeKitデバイスをDIY!
WWDC2017のアップデートとNode-REDを使った簡単なプロトタイプについて
Shingo Tamaki
July 09, 2017
Tweet
Share
More Decks by Shingo Tamaki
See All by Shingo Tamaki
沖縄モバイルアプリ開発勉強会#1
tamaki
0
80
iOSアプリ開発を始めよう
tamaki
0
120
詳解xcresult.pdf
tamaki
0
290
メルペイでのリグレッションテスト自動化推進のこれまでとこれから
tamaki
0
670
What do you want to test with UI Test v2
tamaki
2
840
JPQRによって変わる日本のQRコード決済
tamaki
0
240
What's New in Testing
tamaki
1
58
What do you want to test with UI Test
tamaki
5
1.8k
How to control state in UI Test
tamaki
4
2.5k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
The Language of Interfaces
destraynor
154
24k
The Cult of Friendly URLs
andyhume
78
6k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Done Done
chrislema
181
16k
Designing for humans not robots
tammielis
249
25k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Designing on Purpose - Digital PM Summit 2013
jponch
115
6.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Thoughts on Productivity
jonyablonski
67
4.3k
Transcript
What's new in HomeKit
ࣗݾհ
ࣗݾհ ۄ৴ޛ iOS Engineer! ͖ͳframeworkHomeKitͰ͢ झຯ" ిࢠ࡞⚡ ےτϨ$ ΨδΣοτ%
HomeKitͱʁ
HomeKitͱʁ HomeKitɺAppleͷHomeKit Accessory ProtocolʹରԠͨ͠ ϗʔϜΦʔτϝʔγϣϯػثͱ௨৴͠ɺ͜ΕΛ੍ޚ͢ΔͨΊͷ ϑϨʔϜϫʔΫͰ͢ɻ
HomeKitͷػೳ • ϗʔϜ/ϧʔϜཧ • ΞΫηαϦཧɾૢ࡞ • Ϣʔβཧ • γʔϯ •
τϦΨ • DBڞ༗
ϗʔϜͷϨΠΞτ HomeKitͰHome/Room/Accessory/ServiceʹΑͬͯߏ͞Ε ͍ͯ·͢ɻ
γʔϯ
γʔϯ γʔϯͱଟͷΞΫηαϦૢ࡞ΛҰׅͰߦ͏ҝͷఆٛͰ͢ɻ ʮ͓Α͏ʯʮ͍ͨͩ·ʯͳͲͷৗγʔϯΛΠϝʔδͯ͠ Β͑Εྑ͍ͱࢥ͍·͢ɻ
τϦΨ
τϦΨ HomeKitʹಛఆͷૢ࡞ΛΦʔτϝʔγϣϯԽ͢ΔͨΊͷτϦ Ψ͕༻ҙ͞Ε͍ͯ·͢ɻ • Ґஔใ • ࣌ࠁ • ΞΫηαϦͷঢ়ଶมԽ
Φʔτϝʔγϣϯ
Φʔτϝʔγϣϯ γʔϯͱτϦΨͷΈ߹ΘͤʹΑͬͯΞΫηαϦͷૢ࡞Λࣗಈ Խ͢Δࣄ͕Ͱ͖·͢ɻ
HomeApp ϗʔϜ/ϧʔϜͷΞΫηαϦཧͷૢ࡞iOS10Ͱొͨ͠ HomeΞϓϦͰ؆୯ʹߦ͏ࣄ͕Ͱ͖·͢ɻ ※ HomeKit frameworkΛͬͨαʔυύʔςΟΞϓϦͰߦ͑ ·͢ɻ
DBڞ༗
DBڞ༗ HomeKitͦͷใΛϗʔϜ͝ͱʹDBͱ͓ͯ࣋ͬͯ͠Γɺ ͕iCloudܦ༝ͰผʹDBΛڞ༗ɾมߋࢹΛߦͳ͍ͬͯ· ͢ɻ
͜͜·Ͱ͕͜Ε·ͰͷHomeKitͷ
࠷ۙͷΞοϓσʔτ
Home Pod
Home Pod Amazon EchoGoogle HomeͷΑ͏ͳεϚʔτεϐʔΧ SiriʹΑΔԻૢ࡞ͪΖΜHomeKitʹରԠ
New Accessories
New Accessories εϓϦϯΫϥʔͱऄޱ͕Ճ͞Ε·ͨ͠ɻ
Dates and Times ͜Ε·Ͱͷͷೖ/ͷग़/࣌ࠁ/༵ͷࢦఆ͚ͩͰͳ͘ɺ݄ ͷࢦఆ͕αϙʔτ͞Ε·͢ɻ
Threshold ݻఆ͚ͩͰͳ͘࠷େ/࠷খ/ൣғࢦఆͰΠϕϯτΛτϦΨ͞ ͤΔ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓ·͢ɻ
Presence ෳϢʔβͷҐஔใʹΑΔΠϕϯτΛτϦΨ͕ग़དྷΔΑ͏ʹ ͳΓ·͢ɻ
Presence condition ·ͨɺ͜Ε·ͰͷΠϕϯτͷ݅ʹPresenceΛՃ͑ͯॊೈͳΠ ϕϯτൃՐ͕ग़དྷΔΑ͏ʹͳΓ·͢ɻ
End Event ΞΫηαϦΛىಈͤ͞Δ͚ͩͰͳ͘ɺͦͷऴྃΠϕϯτΛఆٛ ͢ΔࣄͰɺ Ұఆ࣌ؒޙʹऴྃͤ͞ΔͳͲͷૢ࡞͕ग़དྷΔΑ͏ʹͳΓ·͢ɻ
Enhanced Setup Code
Enhanced Setup Code ΞΫηαϦͷηοτΞοϓ࣌ͷίʔυೖྗͷํ๏͕৽͘͠Ճ ͞Ε·ͨ͠ɻ • QR Code • NFC
HAP༷ͷެ։ ͜Ε·ͰΦʔϓϯʹ͞Ε͍ͯͳ͔ͬͨHAPͷ༻͕։ൃऀ͚ ʹެ։͞Ε·ͨ͠ɻ ͜ΕʹΑΓ։ൃऀMFiͷϥΠηϯεܖΛߦ͏͜ͱͳ͘ɺHAP ༷ͷج͖ͮϓϩτλΠϐϯά͕͘͢͠ͳΓ·ͨ͠ɻ વɺ༻ʹMFiϥΠηϯεͷܖ͕ඞཁͰ͕͢ɺ։ൃ࣌ݸ ਓར༻ʹ͍ͭͯMFiΛ௨͢ඞཁ͕ͳ͘ͳΓ·ͨ͠ɻ
ڵຯग़ͯདྷ·͔ͨ͠ʁ (͍·͍ͪʁ)
Node-REDΛͬͨ HomeKit࿈ܞ
https://speakerdeck.com/tamaki/bu-wu-wonaitosihutosuru-in- node-red-ug
https://speakerdeck.com/tamaki/bu-wu-wonaitosihutosuru-in- node-red-ug
https://speakerdeck.com/tamaki/bu-wu-wonaitosihutosuru-in- node-red-ug
Կ͕໘͔ͩͬͨʁ • HomebridgeϓϥάΠϯͷ࣮ • ֎ઢϦϞίϯΛૢ࡞Ϟδϡʔϧͷ࡞
ɹnode-red-contrib-homekit HomebridgeͷϓϥάΠϯ։ൃͳ͠ʹαʔϏελΠϓɾΩϟϥ ΫλϦεςΟοΫΛϊʔυͷઃఆͰબ͢Δ͚ͩͰ؆୯ʹΞΫ ηαϦͷఆٛΛߦ͏ࣄ͕Մೳ node-red-contrib-homekit https://www.npmjs.com/package/node-red-contrib-homekit
͍ํ(1) Node-REDͱnode-red-contrib-homekitͷΠϯετʔϧ $ npm install -g node-red $ cd ~/.node-red/
$ npm install node-red-contrib-homekit
͍ํ(2) node-redͷىಈ(ԼهίϚϯυ)ɺ࣮ߦޙlocalhost:1880ʹϒϥ βͰΞΫηε͠Node-REDͷը໘Λ։͖·͠ΐ͏ɻ $ node-red
͍ํ(3) node-red-contrib-homekit͕Πϯετʔϧ͞Ε͍ͯΕࠨଆͷ Node-REDύϨοτʹHomeKitϊʔυ͕දࣔ͞Ε·͢ɻ
͍ํ(4) HomeKitϊʔυΛυϥοάͯ͠ϑϩʔʹஔ͠ɺμϒϧΫ ϦοΫͯ͠ઃஔΛ࢝Ί·͢ɻ
͍ํ(5) ·ͣAccessoryΛՃ͠·͠ΐ͏ɺฤूϘλϯΛԡͯ͠ Accessoryઃఆը໘ʹભҠ͠·͢
͍ํ(6) AccessoryͷઃఆͰجຊతʹTypeͱ NameͷઃఆΛߦ͍·͢ɻ ͦͷ΄͔ͷ߲ઃఆͰ͖·͕͢ɺجຊ తʹσϑΥϧτͰ͋Γ·ͤΜɻ
͍ํ(7) TypeҰཡ͔Βબ͢ΔܗʹͳΓ· ͢ɻ ྫͱͯ͠FAN(ઔ෩ػ)Λબͨ͠ྫͱ͠ ·͢ɻ
͍ํ(8) ࣍ʹAccessoryͰѻ͏ServiceΛબ͠· ͢ɻ ͜͜ͰAccessory͕FanͳͷͰService FanͰ߹Θ͓͖ͤͯ·͠ΐ͏
͍ํ(9) ͋ͱNodeʹ໊લΛ͚ͯྃͰ͢ɻDeployϘλϯͰσϓϩ Πͯ͠Έ·͠ΐ͏ɻ
͍ํ(10) ࣍ʹiOSͷHomeΞϓϦͰΞΫηαϦͱͯ͠ՃͰ͖Δ͔֬ೝͯ͠Έ·͠ΐ͏ɻ ※ iOSNode-REDΛىಈ͍ͯ͠ΔϚγϯͱಉ͡ωοτϫʔΫʹଓͨ͠ঢ়ଶʹ͍ͯͩ͘͠͞ɻ
͍ํ(11) AccessoryΛHomeKitʹొग़དྷͨΒ࣍ Πϕϯτ௨Λ֬ೝ͍͖ͯ͠·͢ɻ ·ͣHomeΞϓϦ͔Βͷૢ࡞Λߦͬͨ ࣌ʹͲͷΑ͏ͳΠϕϯτ͕Node-REDଆ ʹฦͬͯ͘Δͷ͔Λ֬ೝͯ͠Έ·͢ɻ ֬ೝʹDebugϊʔυΛ༻͠·͢ɻ
͍ํ(11) AccessoryΛHomeKitʹొग़དྷͨΒ࣍ Πϕϯτ௨Λ֬ೝ͍͖ͯ͠·͢ɻ ·ͣHomeΞϓϦ͔Βͷૢ࡞Λߦͬͨ ࣌ʹͲͷΑ͏ͳΠϕϯτ͕Node-REDଆ ʹฦͬͯ͘Δͷ͔Λ֬ೝͯ͠Έ·͢ɻ ֬ೝʹDebugϊʔυΛ༻͠·͢ɻ
͍ํ(12) ࣍Node-REDଆ͔ΒAccessoryͷมԽ Λىͯ͜͠HomeΞϓϦʹมߋ͕ө͞ ΕΔͷΛ֬ೝͯ͠Έ·͠ΐ͏ɻ injectϊʔυΛ༻ͯ͠໌ࣔతʹ HomeKitϊʔυʹinputΛ༩͑ͯΈ· ͢ɻ ͜ͷྫͰ{"foo": "bar"}ͱ͍͏ςΩ τʔͳjsonΛinputͱ͍ͯ͠·͢ɻ
͍ํ(12) ͦͷ߹ɺAccessoryʹׂΓͯͨ ServiceʹͦΕͧΕHAP(HomeKit Accessory Protocol)Ͱఆٛ͞Εͨ Characteristic͕͋ΔͨΊઌ΄ͲͷΑ͏ ͳσʔλΤϥʔͱͳΓdebugλϒʹΤ ϥʔ༰͕දࣔ͞Ε·͢ɻ͜͏͢Δ͜ͱ ʹΑͬͯService͕࣋ͭCharacteristicͷ ΩʔΛΔ͜ͱ͕Ͱ͖·͢ɻ
͍ํ(12) ͨͩɺ͜ͷํ๏ͰCharacteristicͷΩʔΛ୳ͯ͠Λઃఆ͢Δํ ๏͋·Γޮతͱݴ͑·ͤΜ! CharacteristicͷΩʔ͕Θ͔ͬͯͦͷͷܕ(จࣈྻɺɺ ཧͳͲʣ͕Θ͔Βͳ͍ͱ͍͏͋Γ·͢ɻ ɹ ͜ͷʹ͍ͭͯޙ΄Ͳઆ໌͢ΔͷͰҰ୴ઌʹਐΊ·͢ɻ
͍ํ(13) FanʹඞਢͱͳΔCharacteristicͱ͠ ͯ"On"͕͋Γɺͦͷ0͔1ɺͭ·Γ true/falseͷཧͰ͋Δࣄ͕HomeΞ ϓϦΛૢ࡞ͨ࣌͠ͷϩάͱઌ΄ͲͷΤ ϥʔ༰͔ΒਪଌͰ͖·͢ɻ injectϊʔυʹΩʔ"On"ͷΛઃఆͯ͠ ࣮ߦͯ͠Έ·͠ΐ͏ɻHomeΞϓϦͷ Fanͷঢ়ଶ͕มΘΕޭͰ͢ɻ
Characteristicͷ୳͠ํ ઌ΄ͲΘ͟ͱHomeKitϊʔυʹޡͬͨinputΛ༩͑ͯग़ͨΤϥʔ ΛݩʹCharacteristicΛਪଌ͢Δํ๏ΛͱΓ·͕ͨ͠ɺͦΕҎ֎ ͷCharacteristicͷௐํʹ͍ͭͯิ͠·͢ɻ
Characteristicͷ୳͠ ํ Ұ൪࣮֬ͳͷ͕݁ہHAP-NodeJSͷఆٛ ϑΝΠϧΛಡΉࣄͰͨ͠! ྫ͑FanͷCharacteristic͕Γ͍ͨ ߹HomeKitTypes.jsΛݕࡧ͢ΔͱҎ ԼͷΑ͏ͳఆ͕ٛ֬ೝͰ͖·͢ɻ https://github.com/KhaosT/HAP- NodeJS/blob/master/lib/gen/ HomeKitTypes.js
ؾ͖ͮ ͦͷ1 HomeΞϓϦ • DoorbellHomeΞϓϦͰαϙʔτ͍ͯ͠ͳ͍ • σόΠεͷొՄೳɺͨͩ͠DoorbellͷΞΠίϯදࣔ͞ Εͳ͍ɺσόΠεͷมߋ௨ʹԠ͠ͳ͍ • HomeKit
frameworkͷσόΠεͷมߋ௨ϑΥΞάϥϯ υͷΈͳͷͰɺόοΫάϥϯυ࣌ʹυΞϕϧͷมߋ௨ ඈΜͰ͜ͳ͍
ؾ͖ͮ ͦͷ2 DoorbellΞϓϦ • DoorbellΛѻ͍͍ͨ߹HomeKit frameworkΛͬͯΞϓ ϦΛ࡞Δ • HomeKit frameworkͷσόΠεͷมߋ௨ϑΥΞάϥϯ
υͷΈͳͷͰɺόοΫάϥϯυ࣌ʹυΞϕϧͷมߋ௨ ඈΜͰ͜ͳ͍
ॾҙ ͠HomeKitରԠσόΠεͷ։ൃΛߟ͍͑ͯΔͷͰ͋Εɺ HomebridgeΛͦͷ··͏ͷͰͳ͘ɺ͋͘·ͰϓϩτλΠ ϐϯάͷखஈͷҰͭͱ͍ͯΈͨํ͕ྑ͍ͱࢥ͍·͢ɻ
DEMO (ࣄલࡱӨ)
DEMO (ࣄલࡱӨ)
DEMO
Ҏ্