/google-home-notifier

Send notifications to Google Home

Primary LanguageJavaScriptMIT LicenseMIT

google-home-notifier

Send notifications to Google Home

Installation

$ npm install google-home-notifier

Usage

var googlehome = require('google-home-notifier');
var language = 'pl'; // if not set 'us' language will be used

googlehome.device('Google Home', language); // Change to your Google Home name
// or if you know your Google Home IP
// googlehome.ip('192.168.1.20', language);

googlehome.notify('Hey Foo', function(res) {
  console.log(res);
});

Listener

If you want to run a listener, take a look at the example.js file.

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

POST example:
Post JSON of {"SpeakTXT":"Hello this is notifier"}  to play the specified text
Post JSON of {"SpeakMP3":"HelloThisIsNotifier.mp3"} to play the specified MP3 file (hosted by the listener!)

After "npm install"

Modify the following file "node_modules/mdns/lib/browser.js"

vi node_modules/mdns/lib/browser.js

Find this line:

Browser.defaultResolverSequence = [
  rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo()
, rst.makeAddressesUnique()
];

And change to:

Browser.defaultResolverSequence = [
  rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo({families:[4]})
, rst.makeAddressesUnique()
];