0.0.5 • Published 6 years ago
@shooontan/google-home-notifier v0.0.5
@shooontan/google-home-notifier
Send notifications to Google Home.
This module is rewritten in TypeScript based on google-home-notifier. We are freed of the need to build with node-gyp when run npm install.
Install
# npm
$ npm install @shooontan/google-home-notifier
# or yarn
$ yarn add @shooontan/google-home-notifierUsage
const GoogleHomeNotifier = require('@shooontan/google-home-notifier');
(async () => {
const notifier = GoogleHomeNotifier();
await notifier.create();
const message = 'Hi!';
await notifier.say(message);
})();Document
GoogleHomeNotifier(options)
const notifier = GoogleHomeNotifier(options);options arguments is optional.
options.device:stringdevice name. exampleGoogle-Home.options.ip:stringGoogle Home device ip address.options.lang:stringlanguage code. Google Document
notifier.create()
await notifier.create();notifier.create() find out Google Home device ip address and auto set ip address to notifier instance.
If setting options.ip, notifier.create() does not need.
notifier.say(message, options)
await notifier.say(message, options);Send notification to Google Home.
message:stringnotification text.options:objectlang:stringsame as GoogleHomeNotifieroptions.lang.speed:numbernotification text speed. default1.
notifier.play(mp3Url)
await notifier.play(mp3Url)Play mp3 with Google Home.
mp3Url:string|Array<string>