alehos
v1.2.1
Published
Make Alexa homeskill quick
Downloads
10
Readme
Alehos, Alexa homeskill built quickly
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
: discoveryonoff
: turn on and turn off handlingtemperature
: set temperature, increase temperature, decrease temperature handlingpercentage
: set percentage, increase percentage, decrease percentagehealthCheck
: service availability handlinglock
: query and controll door lockcolor
: controll tunable lightingcamera
: 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