LoginSignup
4
8

More than 5 years have passed since last update.

Windows 10 (Windows Subsystem for Linux) で Google Home に喋らせたい

Last updated at Posted at 2017-12-31

多くの人がやっているので特に目新しくはないですが、個人のメモとして残します。

やること

Windows Subsystem for Linux(以下、WSL) に google-home-notifier をセットアップして、何かを喋らせる

WSL とは?とかなら

こちらとてもわかり易いので、読んでセットアップまでしちゃいましょう!

Node.js のセットアップ

apt の向き先を日本のリポジトリに向けて、必要なパッケージをインストール

$ sudo sed -i -e 's%http://.*.ubuntu.com%http://ftp.jaist.ac.jp/pub/Linux%g' /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get install python-minimal make g++ libavahi-compat-libdnssd-dev

nodebrew と Node.js のセットアップ

$ curl -L git.io/nodebrew | perl - setup
$ echo 'PATH="$HOME/.nodebrew/current/bin:$PATH"' >> ~/.profile
$ source ~/.profile
$ nodebrew install-binary latest
$ nodebrew use latest

確認(2017/12/31 現在の表示)

$ node -v
v9.3.0
$ npm -v
5.5.1

必要なサービスの起動と自動起動化

$ sudo service dbus start
$ sudo service avahi-daemon start
$ sudo systemctl enable dbus
$ sudo systemctl enable avahi-daemon

google-home-notifier のインストール

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

動かしてみる

example.js という例がついているので、下記部分を修正後に保存する

var deviceName = 'Google Home';  // <-- Google Home に設定した名前に書き換える
var ip = '192.168.1.20'; // <-- Google Home の IP アドレスに書き換える
var language = 'ja'; // <-- 書き換える

起動させる

$ node example.js &

メッセージの最後に例が表示されるので、コピペでそのまま実行してみると「へろぉ~ぅ ぐ~ぐる ほ~む」と話ししてくれるはず

GET example:
curl -X GET https://xxxxxxxx.ngrok.io/google-home-notifier?text=Hello+Google+Home
POST example:
curl -X POST -d "text=Hello Google Home" https://xxxxxxxx.ngrok.io/google-home-notifier
4
8
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
4
8