alehos3

2.1.2 • Public • Published

Alehos, Alexa homeskill built quickly

Build Status JavaScript Style Guide

Note: this package is under development, you should no rely on this for production.

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

Alehos support routing for the Smart Home Skill API v3.

how to use

let Alehos = require('alehos3')
 
let alehos = new Alehos()
 
alehos.registerHandler('discover', (req, cb) => {
  // get the payload
  // const payload = { ... }
  cb(null, null, payload)
})
 
alehos.registerHandler('powerControllerTurnOn', (req, cb) => {
  // action ...
  // finally return OK
  cb(null)
})
 
exports.handler = function(event, context, cb) {
  alehos.handle(event, context, cb)
}

supported functions

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

req

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

cb(err, contextProperties, eventPayload)

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.ERR_ENDPOINT_UNREACHABLE
return cb(err)

todos

  • support all functions
  • set/get the event function

license

MIT

Readme

Keywords

Package Sidebar

Install

npm i alehos3

Weekly Downloads

1

Version

2.1.2

License

MIT

Unpacked Size

125 kB

Total Files

89

Last publish

Collaborators

  • ninhxuanluu
  • nqd