Created
May 11, 2018 11:12
-
-
Save manish-wedigtech/6a33557d3870389b9fcfd88f949823b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var alexa = require('alexa-app'); | |
var app = new alexa.app(); | |
app.launch(function(request, response) { | |
console.log(request); | |
response.say("Welcome to OVAL. You can get sensor updates, set parameters for your sensors, and toggle battery saving mode. What would you like?."); | |
response.shouldEndSession(false); | |
}); | |
app.intent('BatterySavingModeOn', { | |
"slots": {}, | |
"utterances": [ | |
"Switch-on battery saving mode.", | |
"Enable battery svaing mode." | |
] | |
}, | |
function(request, response) { | |
BatterySavingOn(response); | |
response.shouldEndSession(false); | |
return; | |
} | |
); | |
function BatterySavingOn(response) { | |
var food = ["Thai", | |
"Sushi", | |
"Chik-fil-a", | |
"Smash Burgers", | |
"Uncle Julio's" | |
]; | |
var rand = food[Math.floor(Math.random() * food.length)]; | |
response.say("BatterySavingOn Called, How about some " + rand + " today?"); | |
response.send(); | |
return; | |
} | |
app.intent('BatterySavingModeOff', { | |
"slots": {}, | |
"utterances": [ | |
"Switch-off battery saving mode.", | |
"Disable battery svaing mode." | |
] | |
}, | |
function(request, response) { | |
BatterySavingOff(response); | |
response.shouldEndSession(false); | |
return; | |
} | |
); | |
function BatterySavingOff(response) { | |
var food = ["Thai", | |
"Sushi", | |
"Chik-fil-a", | |
"Smash Burgers", | |
"Uncle Julio's" | |
]; | |
var rand = food[Math.floor(Math.random() * food.length)]; | |
response.say("BatterySavingOff Function called, How about some " + rand + " today?"); | |
response.send(); | |
return; | |
} | |
app.intent('EditParameters', { | |
"slots": [{ | |
"name": "all", | |
"type": "AllSensors" | |
}, | |
{ | |
"name": "DegreeOfLevel", | |
"type": "TypesOfLevel", | |
"samples": [ | |
"{DegreeOfLevel}" | |
] | |
}, | |
{ | |
"name": "SensorType", | |
"type": "TypesOfSensors", | |
"samples": [ | |
"{SensorType}" | |
] | |
} | |
], | |
"utterances": [ | |
"Set {SensorType} sensor to {DegreeOfLevel} level.", | |
"Set light sensor to {DegreeOfLevel} level.", | |
"Set moisture sensor to {DegreeOfLevel} level.", | |
"Set temperature sensor to {DegreeOfLevel} level.", | |
"Enable flood sensor." | |
] | |
}, | |
function(request, response) { | |
EditParameters(response); | |
response.shouldEndSession(false); | |
return; | |
} | |
); | |
function EditParameters(response) { | |
var food = ["Thai", | |
"Sushi", | |
"Chik-fil-a", | |
"Smash Burgers", | |
"Uncle Julio's" | |
]; | |
var rand = food[Math.floor(Math.random() * food.length)]; | |
response.say("EditParameters Function called How about some " + rand + " today?"); | |
response.send(); | |
return; | |
} | |
// Connect to lambda | |
exports.handler = app.lambda(); | |
if ((process.argv.length === 3) && (process.argv[2] === 'schema')) { | |
//console.log(app.schema()); | |
//console.log(app.utterances()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment