LoginSignup
19
20

More than 5 years have passed since last update.

IRKitのマニュアルセットアップ

Posted at

公式アプリを使わないでセットアップする場合のメモ。IRKit Internet APIを使って外部からIRKitを操作するまでの手順。公式ページだと1手づつ進めるのにページを行ったりきたりしないといけないので、時系列に並べた。

APIキーの取得

$ curl -i -d "email=hagino.3000@gmail.com" "https://api.getirkit.com/1/apps"
HTTP/1.1 200 OK
Server: ngx_openresty
Date: Sat, 22 Nov 2014 16:40:21 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 92
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
X-Content-Type-Options: nosniff

{"message":"You will receive an email shortly, please click the URL in it to get an apikey"}%

指定したメールアドレスに確認メールが届くのでそこからAPIキーを入手できる。

ClientKeyの取得

APIKeyを使う。

$ curl -i -d "apikey=$MY_API_KEY" "https://api.getirkit.com/1/clients"
HTTP/1.1 200 OK
Server: ngx_openresty
Date: Sat, 22 Nov 2014 16:42:59 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 48
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
X-Content-Type-Options: nosniff

{"clientkey":"$MY_CLIENT_KEY"}%

DeviceKeyの取得

ClientKeyを使う。

$ curl -i "https://api.getirkit.com/1/devices" -d "clientkey=$MY_CLIENT_KEY"
HTTP/1.1 200 OK
Server: ngx_openresty
Date: Sat, 22 Nov 2014 17:23:39 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 94
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
X-Content-Type-Options: nosniff

{"devicekey":"$MY_DEVICE_KEY","deviceid":"$MY_DEVICE_ID"}%

Wifi接続先の指定

DeviceKeyとwifi接続情報を使う。

まず

  1. リクエストボディのシリアライズ、このページのJSコードをコピペして実行すれば良い。
  2. 作業マシンをIRKitのwifiに接続する、IRKitのwifi APが無い場合はIRKit本体をリセットする。
  3. IRKitの箱に添付されているwifi APのパスワードを入力する
  4. IRKitのwifiに接続できた事を確認する

この時IRKitのIPアドレスは 192.168.1.1 になる。この状態で次のコマンドで /wifi を叩く。

$ curl -i "http://192.168.1.1/wifi" -d '$SERIALIZED_BODY'
HTTP/1.0 200 OK
Access-Control-Allow-Origin: *
Server: IRKit/2.1.2.0.g424fa95
Content-Type: text/plain

ランプが青の点灯になればOK。作業マシンをIRKitのwifiネットワークから外して元のネットワークに戻す。

リモート接続の確認

ClientKeyとDeviceIdを使う。

これは外部のIRKitサーバーから、IRKitへの疎通確認である。hostnameが返ってこればIRKit Internet API経由でIRKitを操作できる。

$ curl -i "https://api.getirkit.com/1/door" \
     -d 'clientkey=$MY_CLIENT_KEY' \
     -d 'deviceid=$MY_DEVICE_ID'

HTTP/1.1 200 OK
Server: ngx_openresty
Date: Sat, 22 Nov 2014 17:38:37 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 24
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
X-Content-Type-Options: nosniff

{"hostname":"IRKitXXXF"}%
19
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
20