https://github.com/ghostrick/node-googlehome
π° It uses Node.js to communicate with Google Home.
https://github.com/ghostrick/node-googlehome
google googlehome javascript nodejs
Last synced: about 1 year ago
JSON representation
π° It uses Node.js to communicate with Google Home.
- Host: GitHub
- URL: https://github.com/ghostrick/node-googlehome
- Owner: ghostrick
- License: mit
- Created: 2017-12-25T00:18:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-08T23:42:13.000Z (over 7 years ago)
- Last Synced: 2025-03-27T17:51:49.502Z (about 1 year ago)
- Topics: google, googlehome, javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 19
- Watchers: 1
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-googlehome
It uses Node.js to communicate with Google Home.
[](https://badge.fury.io/js/node-googlehome)
[](https://travis-ci.org/Ghostrick/node-googlehome)
## Install
### npm
```bash
$ npm install node-googlehome --save
```
### yarn
```bash
$ yarn add node-googlehome
```
## Usage
```js
const GoogleHome = require('node-googlehome')
/**
* search google home.
* @param {waitTime: number(default: 1000)}
*/
GoogleHome.search(1000)
.then(resp => { console.log(resp) })
/**
* connect google home with IP.
* @param {ip_address: string}
*/
let device = new GoogleHome.Connecter('192.168.11.13')
/**
* setting language
* @param {{lang: string(default: 'en')}}
*/
device.config({lang: 'ja'})
/**
* Start speaker.
* If you do this, google home will immediately sound when you call speak() or playMedia()
*/
device.readySpeaker()
.then(() => { /* do something */ })
/**
* play media. pass media url.
* @param {url: string}
*/
device.playMedia('http://www.hypertrombones.jp/sample/system7.mp3')
.then(console.log)
.catch(console.log)
/**
* google home speak!
* @param {message: string, speed: number(default:1), timeout: number(default: 3000)}
*/
device.speak('γγγ«γ‘γ―οΌ')
.then(console.log)
.catch(console.log)
```
## Requirements
γ»Node.js >= v7