ベッドでだらだらしていると、だんだんウトウトしてくる。
あーもうこのまま意識飛んで寝そう。っていう時に、電気とテレビを消すために
わざわざテーブルに置いてあるリモコンを取りに行きたくない。
システム構成
- iPhone7
- Siri
- HomeKit
- Raspberry Pi
- homebridge
- homebridge-irkit
- IRKit (API付き学習リモコン)
- 家電製品
- 照明
- テレビ
- エアコン
この中でも今回の要はhomebridge
homebridge
homebridge-irkitをラズパイで動かします。
このサーバーはHomeKit互換なため、設定ファイルにjsonで各家電の赤外線情報を定義することで
IRKitにHTTPリクエストを飛ばして、家電製品に赤外線信号を送ることができる。
{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:ED:CE:30", "port": 51826, "pin": "000-00-000" }, "description": "IRKit Control", "accessories": [ { "accessory": "IRKit", "name": "電気", "irkit_host": "IRKit1B4D.local", "on_form": {"format":"raw","freq":38,"data":[19991,10047,1413,3579,1413,3579,1413,3579,1413,1111,1413,1111,1413,3579,1413,3579,1413,3579,1413,1111,1413,1111,1413,3579,1413,3579,1413,1111,1413,1111,1413,1111,1413,1111,1413,3579,1413,3579,1413,1111,1413,1111,1413,3579,1413,1111,1413,1111,1413,3579,1413,1111,1413,1111,1413,3579,1413,3579,1413,1111,1413,3579,1413,3579,1413,1111,1413]}, "off_form": {"format":"raw","freq":38,"data":[19991,10047,1319,3704,1319,3704,1319,3704,1319,1190,1366,1190,1366,3704,1319,3704,1319,3704,1319,1190,1319,1190,1319,3704,1319,3704,1319,1190,1319,1190,1319,1190,1319,1190,1319,3704,1319,3704,1319,1190,1319,3704,1319,1190,1319,1190,1319,1190,1319,3704,1319,1190,1319,1190,1319,3704,1366,1150,1319,3704,1319,3704,1319,3704,1319,1190,1319,65535,0,24574,19991,4878,1366]} } ] }
またIRKitに以下のHTTPリクエストを送ることで
1番最後に受信した赤外線情報をjsonで吐き出してくれます。
$ curl -i "http://10.0.1.2/messages" -H "X-Requested-With: curl" HTTP/1.0 200 OK Access-Control-Allow-Origin: * Server: IRKit/2.1.3.13.gbe33d36 Content-Type: text/plain {"format":"raw","freq":38,"data":[18031,8755,1190,1190,1190,3341,1190,3341,1190,3341,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,1190,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,65535,0,9379,18031,4400,1190]}
IRKit - Open Source WiFi Connected Infrared Remote Controller
必要な家電製品の赤外線を設定ファイルに書いたら
homebridgeサーバーを起動
pi@raspberrypi:~ $ homebridge *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node> *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister> [2017-02-08 23:42:24] Loaded plugin: homebridge-cmd [2017-02-08 23:42:24] Registering accessory 'homebridge-cmd.CMD' [2017-02-08 23:42:24] --- [2017-02-08 23:42:24] Loaded plugin: homebridge-irkit [2017-02-08 23:42:24] Registering accessory 'homebridge-irkit.IRKit' [2017-02-08 23:42:24] --- [2017-02-08 23:42:24] Loaded config.json with 7 accessories and 0 platforms. [2017-02-08 23:42:24] --- [2017-02-08 23:42:24] Loading 7 accessories... [2017-02-08 23:42:24] [テレビ] Initializing IRKit accessory... [2017-02-08 23:42:24] [電気] Initializing IRKit accessory... [2017-02-08 23:42:24] [エアコン] Initializing IRKit accessory... Scan this code with your HomeKit App on your iOS device to pair with Homebridge: ┌────────────┐ │000-00-000 │ └────────────┘
あとはiPhoneのホームアプリから接続設定をすると
HomeKit経由で各種デバイスのオンオフが可能。
Siriだけじゃなく、コントロールキットからも操作できて便利
参考URL
Raspberry Pi3 Model B ボード&ケースセット 3ple Decker対応 (Element14版, Clear)-Physical Computing Lab
- 出版社/メーカー: TechShare
- メディア: エレクトロニクス
- この商品を含むブログ (4件) を見る
ラズパイ3はけっこうメモリも豊富でよかった
常時起動の場合はヒートシンク要るとか聞いてたけど、今のとこなんとかなってる
冬だからかも?
IRKit - iPhone,iPadを使って外出先からエアコン等の家電を操作できる学習リモコン
- 出版社/メーカー: maaash.jp
- メディア: ホーム&キッチン
- この商品を含むブログ (2件) を見る
青色LEDがちょっとまぶしいのが難点
後継機のNature Remoはちょっと値上がりして、動体センサーや湿度計もついてるらしい