前回はgoogle-home-notifierを導入しました。
ハマったポイントを書いておきます
要はREADMEをちゃんと読めっていう話なんですが。
git-core
libnss-mdns
libavahi-compat-libdnssd-dev
はインストールすること
よしなに、
sudo apt-get update
してから、
sudo apt-get install git-core libnss-mdns libavahi-compat-libdnssd-dev
をしましょう。私の環境の場合、すでにこれらが入っていたので動いていたようです。
mdnsを使う場合はファイルを書き換える
ここに書いてあるとおり、node_modules/mdns/lib/browser.js
を書き換える必要があります。
Browser.defaultResolverSequence = [ rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo() , rst.makeAddressesUnique() ];
このような記載を、
Browser.defaultResolverSequence = [ rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo({families:[4]}) , rst.makeAddressesUnique() ];
と書き換えて上げる必要があります。{families:[4]}
を追加するだけです。
これにより、
googlehome.device('Google Home Mini', language); googlehome.ip('192.168.xxx.xxx');
と書いていた部分の、googlehome.ip('192.168.xxx.xxx');
の部分を取り除いても正しくワークします。
WARNINGが出るけど、放っておく
これでいいのかな・・・。
*** 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>
確かにきになるんですが、正しくワークしてるので、気にしないでおきます。
Echo Dot (エコードット) 第2世代 - スマートスピーカー with Alexa、ブラック
- 発売日: 2018/04/03
- メディア: エレクトロニクス