Giter Club home page Giter Club logo

alehos's Introduction

Alehos, Alexa homeskill built quickly

Build Status JavaScript Style Guide

So that you dont need to write boilerplate code for Alexa Home Skill with Nodejs.

Alehos support routing for the Smart Home Skill API updated February 28, 2017 April 7, 2017 June 22, 2017.

How to use

let Alehos = require('alehos')

let alehos = new Alehos()

alehos.registerHandler('discover', (req, cb) => {
  // get the payload
  cb(null, payload)
})

alehos.registerHandler('onoff', (req, cb) => {
  // check if the request is on/off by looking at req.event.header.name
  // action
  // finally return OK
  cb(null)
})

exports.handler = function(event, context, cb) {
  alehos.handle(event, context, cb)
}

supported functions

  • discover: discovery
  • onoff: turn on and turn off handling
  • temperature: set temperature, increase temperature, decrease temperature handling
  • percentage: set percentage, increase percentage, decrease percentage
  • healthCheck: service availability handling
  • lock: query and controll door lock
  • color: controll tunable lighting
  • camera: query camera streaming

If you don't provide equivalent function, the response will be UnsupportedOperationError.

req

req is actually the event and context object from lambda request. You should looking at event for request message.

cb

cb is the response function.

If you want to return error, generate an new error object, with code of the intented error. Example:

// if the device is un reachable
let err = new Error()
err.code = alehos.code.ERROR_TARGET_OFFLINE
return cb(err)

License

MIT

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.