Skip to content

Latest commit

 

History

History
149 lines (92 loc) · 3.54 KB

README.md

File metadata and controls

149 lines (92 loc) · 3.54 KB

Peak Home Automation

Dependencies

  • NodeJS

  • NPM

  • MySQL, PostgreSQL, or SQLite

    • Create admin with password

    • Create database peaknode

    • Grant user priviledges

  • Omnilink


Description

NodeJS - API Server ExpressJS - API Middleware SequelizeJS - PostgreSQL, MySQL, MariaDB, SQLite Middleware.

File structure

  • /app.js: Load and serve API resources

  • /config.json: Configuration info for port, DB, session, static models, etc.

  • /routes.js: API endpoints

  • /controllers: API endpoint handlers

  • /models: SequelizeJS models

  • /lib: NodeJS helper classes

    • /lib/database.js: Setup SequelizeJS models, relationships, and triggers

    • /lib/fitbit.js: Fitbit OAuth helper

    • /lib/omnilink.js: TCP connection to Java server

    • /lib/xbmc.js: XBMC connection/command helper


Routes

* - Requires sessionID

Method Endpoint Action
POST /user Create User
POST /login Login User
POST /logout *Logout User
POST /auth *Check Auth
GET /users List Users
GET /user/:uid Show User
Method Endpoint Action
GET /appliances List Appliances
POST /appliance/:id *Switch Appliance
Method Endpoint Action
GET /appliances List Audio Zones
GET /appliance/:id Show Audo Zone
POST /appliance/:id *Set Audio Zone
Method Endpoint Action
GET /security Security Status
GET /security/:id
POST /security/:id *Set Audio Zone

### User Routes #### Create User
  • @body username
  • @body password
  • @body realname
  • @body pinkey (4 digits)
#### Login User
  • @body username
  • @body password
#### Logout User #### Check Auth #### List Users #### Show User
  • @param uid

### Appliance Routes #### List Appliances #### Switch Appliance
  • @body state (on|off)
  • @body node (left|right)

### Audio Routes #### List Audio Zones #### Show Audio Zone