Package Exports
- google-home-notifier-volume-adjustable
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-home-notifier-volume-adjustable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
google-home-notifier-VolumeAdjustable
This is a fork of the google-home-notifier-library: google-home-notifier Fork
Send notifications to Google Home
Installation
$ npm install google-home-notifierUsage
var googlehome = require('google-home-notifier');
googlehome.device('Google Home'); // Change to your Google Home name
googlehome.accent('us'); // optional: 'us'= american voice (default), 'uk'= british voice
googlehome.notify('Hey Foo', function(res) {
console.log(res);
});
googlehome.setEmitVolume(pctVolume,function(){
// code to be executed after emit volume has been set
});
// note, the emit volume level has to be set only once. When notification is played the volume will be set to the saved emit level and after notification reset to it's initial levelListener
If you want to run a listener, take a look at the example.js file. You can run this from a Raspberry Pi, pc or mac. The example uses ngrok so the server can be reached from outside your network. I tested with ifttt.com Maker channel and it worked like a charm.
$ git clone https://github.com/orcema/google-home-notifier
$ cd google-home-notifier
$ npm install
$ node example.js
POST "text=Hello Google Home" to:
http://localhost:8080/google-home-notifier
https://xxxxx.ngrok.io/google-home-notifier
example:
curl -X POST -d "text=Hello Google Home" https://xxxxx.ngrok.io/google-home-notifierRaspberry Pi
If you are running from Raspberry Pi make sure you have the following before nunning "npm install": Use the latest nodejs dist.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install nodejsAlso install these packages:
sudo apt-get install git-core libnss-mdns libavahi-compat-libdnssd-devAfter "npm install"
Modify the following file "node_modules/mdns/lib/browser.js"
vi node_modules/mdns/lib/browser.jsFind 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()
];