0.0.5 • Published 5 years ago

@shooontan/google-home-notifier v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@shooontan/google-home-notifier

npm version Build Status

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. example Google-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 GoogleHomeNotifier options.lang.
    • speed: number notification text speed. default 1.

notifier.play(mp3Url)

await notifier.play(mp3Url)

Play mp3 with Google Home.

  • mp3Url: string | Array<string>