LoginSignup
3
3

More than 5 years have passed since last update.

MacでAmazone Dashボタンで遊ぶ 自分用メモ

Last updated at Posted at 2017-02-17

Homebrewインストール

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

1)Nodebrewをインストール

brew install nodebrew

2)Nodebrewをセットアップ

nodebrew setup

3)bash_profileにパスの設定を書き込む

echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile

4)bash_profileを再読込し、追加したパスを有効にする

source ~/.bash_profile

Node.jsをインストール

nodebrew install-binary stable

使用するバージョンを選択

nodebrew use stable

dasherをcloneしてくる

足りないモジュールがあるので取ってくる

npm install -g npm-install-missing
npm-install-missing

Amazone Dashボタンの設定

Amazoneアプリで設定を進め、注文する商品を選択する画面で右上の
✖ボタンを押してキャンセルしてください。
表示されるアラートはスルーで

Amazone Dashボタンのmacアドレスを調べる

./script/find_button

amazone dashボタンを押して Amazon Technologies Inc.と表示されるmacアドレスをメモ
cloneしてきたdasher/config/以下にconfig.json作成

config.json
{"buttons":[
  {
    "name" : "ボタンの名前",
    "address": "さっきメモったmacアドレス",
    "url": "ボタンが押されたときに飛ぶURL",
    "method": "POST",
    "json": true,
    "body": {"text":"Hello"}
  }
]}

dasherを起動

npm start

ボタンが押されるとコンソールにボタンが押された表示がされます
なんかエラー出たら取り合えすsudoつけとけばいいと思います

config.jsonのurlをIFTTTのMaker Eventのurl設定しておけば色々楽しめそうです
以上です

3
3
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
3
3