@shooontan/google-home-notifier
v0.0.5
Published
Pure JavaScript Google-Home notifier
Downloads
3
Maintainers
Readme
@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-notifier
Usage
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
:string
device name. exampleGoogle-Home
.options.ip
:string
Google Home device ip address.options.lang
:string
language 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
:string
notification text.options
:object
lang
:string
same as GoogleHomeNotifieroptions.lang
.speed
:number
notification text speed. default1
.
notifier.play(mp3Url)
await notifier.play(mp3Url)
Play mp3 with Google Home.
mp3Url
:string
|Array<string>