GithubHelp home page GithubHelp logo

fredkelly / echo-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghballiet/echo-api

0.0 3.0 0.0 154 KB

First attempt at an API for Amazon Echo.

License: MIT License

JavaScript 100.00%

echo-api's Introduction

amazon-echo-api

This is (almost, kind of) an API for Amazon Echo. Video Demonstration

This code is not for the faint of heart. I wrote it in about three hours, the day after I got my Echo, and there are a lot of improvements to be made. The original goal was just a proof-of-concept, to see if I could make Echo do what I wanted. My goal with releasing the source is to help out other like-minded Echo owners.

Prerequisites

  • Wolfram Alpha API Key: this is used for converting the plain-text numbers that Echo records (e.g., "seventy three") into integers that can be used to set the temperature. Maybe there's another Node package out there to do this, but this seemed like the easiest way to get it working. Get a key here.
  • Username for your Hue: if you're not messing with Hue, then don't worry about it. This was pretty easy to do in the Node REPL by loading node-hue-api and just typing in the commands. Later versions of this app should generate a new username (assuming it doesn't have one saved) and save it for use later.

Amazon Echo Credentials

I haven't integrated with any actual Amazon login systems yet. For now, in order to connect this application to your Echo, you'll need to do the following:

  1. Using Chrome, go to http://echo.amazon.com and sign in.
  2. Open the developer tools (Cmd+Shift+J on Mac, or Ctrl+Shift+J on Windows).
  3. On the page, click on your Todo list.
  4. In the network tab, clear all entries.
  5. Add a new todo to the list. You should see a POST request in the network tab to https://pitangui.amazon.com/api/todos.
  6. Right click on this request in the list, and select "Copy as cURL".
  7. In a text editor, paste the cURL command from your clipboard, and copy the entire Cookie: ... header (excluding the "Cookie: " text).
  8. Open api/echo/.credentials.json in your text editor (relative to wherever you checked out this repo).
  9. Highlight PasteEchoCookieHere and paste from your clipboard. This string has quotes in it; make sure to escape them before saving the file.
  10. Replace CsrfValueGoesHere with the CSRF value from the cookie string (should be a large integer).

Other Credentials

Other credentials are located in api/nest/.credentials.json and api/hue/.credentials.json. Your Nest credentials are the same ones you use to log in to the app, and the username for Hue is explained above (in "Prerequisites").

Running the App

This is a Node app, so (after adding the required credentials) running the app is really just two steps:

  1. Run npm install to install required packages.
  2. Run node app to run the app.

Todo

  • actual Amazon login (rather than this cookie hack)
  • better credential management overall
  • look for a better way of converting "seventy three" to 73
  • automatic creation of usernames for Hue (should be trivial, but it would be good to add it)
  • "global" commands (that don't require a prefix)
  • maybe get rid of the whole prefix idea altogether
  • "scenes" (tasks that can call subtasks; i.e., set the lights and temperature)

echo-api's People

Contributors

ghballiet avatar jhmartin avatar

Watchers

 avatar  avatar  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.