22
24

More than 5 years have passed since last update.

Windowsでgoogle-home-notifierを使う

Last updated at Posted at 2017-12-17

WindowsからGoogleHomeに喋らせたいなと思ったものの見つかる記事がラズパイ向けばかりだったので苦労したメモ

手順的なもの

  1. Node.jsを入れる
  2. python2.7を入れる
  3. windows-build-toolsを入れる
  4. node-gypを入れる
  5. Bonjour SDKを入れる
  6. Bonjour Print Serviceを入れる
  7. google-home-notifierを入れる
    • google-home-notifierをちょっと書き換える

Node.jsを入れる

私はNodistで入れました

nodist + 8
nodist npm match

Pythom2.7を入れる

Download Python | Python.org
インストールしたらパスを通す

windows-build-tools入れる

npm install -g windows-build-tools

node-gyp入れる

npm install -g node-gyp

Bonjour SDK入れる

https://developer.apple.com/download/more/?=Bonjour SDK for Windows

Bonjour Print Service入れる

ダウンロード - Bonjour Print Services (Windows)

google-home-notifier入れる

あとは他の記事にあるように

npm install google-home-notifier

または

git clone https://github.com/noelportugal/google-home-notifier
cd google-home-notifier
npm install

で入れてexample.jsあたりのipやlanguageを環境に合わせる
※example.jsはnpm installしたものとgit cloneしたものは別物っぽい

git cloneしたものであれば

node example.js

でサーバが立ち上がりエンドポイントが表示されるので

# 「ディルン」という音の後に「Hello Google Home」と言う
curl https://xxxxx.ngrok.io/google-home-notifier?text=Hello+Google+Home

としてやれば喋ってくれる:blush:

...のだが、ip指定の場合、日本語メッセージを送っても喋ってくれない:sob:

# 「ディルン」という音だけで「こんにちは」を言わない
curl https://xxxxx.ngrok.io/google-home-notifier?text=こんにちは

google-home-notifier.jsを確認してみる

google-home-notifier.js
var device = function(name, lang = 'en') {
    device = name;
    language = lang;
    return this;
};

var ip = function(ip) {
    deviceAddress = ip;
    return this;
}

???
deviceの方はlangを引数に受けて設定してるけどipの方はlangを引数をして受けてないぞ???:fearful:
ってことでipもlangを受け取れるように変更:muscle:

var ip = function(ip, lang = 'en') {
    deviceAddress = ip;
    language = lang;
    return this;
}

変更後、example.jsを起動し直して

curl https://xxxxx.ngrok.io/google-home-notifier?text=こんにちは

やりました:sunglasses:

22
24
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
22
24