Git Product home page Git Product logo

smart-clapper's Introduction

Sending Google Assistant Command via REST API

Ref. Assistant Relay Installation

Installation

  1. Install node.js version 10.13.0 (using nvm) nvm for window
  2. Install PM2 by $ npm i pm2 -g (using Windows PowerShell)
  3. Install Assistant Relay by download Assistant Relay V3.2.0 release.zip
  4. Extract the folder and run $ npm i inside that folder

Config Google Account

  1. Configure Google Develop Project (step 1 - 6)
  2. Go to Google Developer Console
  3. Click on the Credentials link in the left hand menu
  4. At the top, click the Create Credentials button and select OAuth Client ID
  5. Select Web Application from the dropdown list
  6. Give your client ID a name, such as Assistant Relay. Click Create.
  7. Click the Download button to download your secret_client json file.

Assistant Relay Setup

  1. Modify secret_client_xxx.json by changing "web" key to "installed"
  2. Run $ npm run start and open the Assistant Relay webpage on browser
    Note: If error occurs, try kill running process TASKKILL /F /IM node.exe /FI "PID gt 0" (using Windows PowerShell)
  3. Upload secret_client_xxx.json to the webpage, add your user name and click next.
  4. It will pop up the Google Account linking page, authorize it with your Google Account
  5. It will now show the blank white page with some text on it. Copy the code in the url
    http://localhost/?code=**COPYCODEFROMHERE**&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype
    Ref. link
  6. Come back to the Assistant Relay webpage, and paste the code.
  7. The user is added.

Test with postman

Ref. Assistant Relay Command Usage

  1. Command the device
    POST to , for example, http://192.168.1.157:3000/assistant, with the body of raw json format
{
    "command": "turn on the fan",
    "converse": false,
    "user": "earth"
}

Note: When want to command the Device, "converse" must be false.

  1. Broadcast to Google Home device
{
    "command": "hello world",
    "broadcast": true,
    "user": "earth"
}

Demo Video

  1. Assistant Relay demo with Postman Youtube link

smart-clapper's People

Contributors

earthtennison avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.