Coder Social home page Coder Social logo

tommylans / node-nest-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cylwin/node-nest-api

0.0 1.0 0.0 25 KB

Main Nest API for node (also see: nest-api-thermostat and nest-api-protect)

License: MIT License

JavaScript 19.57% CoffeeScript 64.61% Makefile 15.82%

node-nest-api's Introduction

NPM version Build Status Coveralls Status Dependency Status

nest-api

Main Nest API for node (also see: nest-api-thermostat-api and nest-api-protect-api) Adapted from:

Installation

npm install nest-api

Usage

Configuration

In order to instantiate and use the main Nest API should use the following:

var NestApi = require('nest-api');
var nestApi = new NestApi('YOUR_EMAIL', 'YOUR_PASSWORD');
// Login (must be called first to establish a session)
nestApi.login(function(data) {
    // A callback for something you would want to do on login
});

nestApi.get(function(data) {
  // Get a property from the Nest API.  See the Appendix for a list of properties.
});

Examples

var NestApi = require('nest-api');
var nestApi = new NestApi('YOUR_EMAIL', 'YOUR_PASSWORD');

nestApi.login(function(data) {
  nestApi.get(function(data) {
    var shared = data.shared[Object.keys(data.schedule)[0]];
    console.log('Currently ' + shared.current_temperature + ' degrees celcius');
    console.log('Target is ' + shared.target_temperature + ' degrees celcius');
  });
});

Contributing

Please feel free to modify and contribute to this code:

License

See LICENSE

TODO

  • Implement Nock for testing
  • Write generic getter for information
  • Research POST operations for Nest API and write setters

Appendix

Below is an example data structure / JSON object returned from the Nest API:

{
  user_alert_dialog: { '###':  { /* ... */ } },
  track:  { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  message_center: { '###': { /* ... */ } },
  utility: { /* ... */ },
  where: { '### uuid ###': { /* ... */ },
  structure: { '### uuid ###': { /* ... */ },
  message: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  tuneups: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  device: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  demand_response: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  user: { '###': { /* ... */ },
  link: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  device_alert_dialog: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  metadata: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  user_settings: { '###': { /* ... */ },
  schedule: { '0123456789ABCDEF': { /* ... */ }, /* ... */ },
  shared: { '0123456789ABCDEF': { /* ... */ }, /* ... */ }
 }

node-nest-api's People

Contributors

cylwin avatar intuity avatar johnwyles avatar nihakue avatar tommylans avatar zivc 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.