Androidのメモとか

ポキオの日記です。今日も遅延してない。

Raspberry Piにgoogle-home-notifierを導入するときのメモ

google-home-notifier on Raspberry Pi and nougat

前回はgoogle-home-notifierを導入しました。

relativelayout.hatenablog.com

ハマったポイントを書いておきます

要は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>

確かにきになるんですが、正しくワークしてるので、気にしないでおきます。

「Androidのメモとか」は、Amazon.co.jpを宣伝しリンクすることによってサイトが紹介料を獲得できる手段を提供することを目的に設定されたアフィリエイト宣伝プログラムである、Amazonアソシエイト・プログラムの参加者です。

このブログは個人的なメモ書きであったり、考えを書く場所であります。執筆者の所属する団体や企業のコメントや意向とは無関係であります。また、このブログは必ずしも正しいことが書かれているとは限らず、誤字脱字や意図せず誤った情報を載せる場合がありえます。それが原因で読者が不利益を被ったとしても、執筆者はいかなる責任も負いません。ありがとうございます。