This file contains hidden or 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
// base64 encoder (btoa) / decoder (atob) which you can use in your NativeScript app. | |
// | |
// Usage (assuming you're in some component and this file is in the same folder: | |
// | |
// require('./base64'); | |
// | |
// const username = "My Usernamé"; | |
// usernameBase64Encoded = btoa(username); | |
This file contains hidden or 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
let deviceId = this.event.context.System.device.deviceId; | |
this.context.log('deviceId = ', deviceId); // will help you find out what the device ID is so you can add it into the global devices object | |
// get the mapping to the intent object | |
let intent = this.event.request.intent; | |
this.context.log('intent - ', intent); | |
// get the authority that is returning from alexa service. filter it based on your alexa app ID and the Control_List name you gave it | |
let authority = intent.slots.Control.resolutions.resolutionsPerAuthority.filter(auth => auth.authority.includes(GetEnvironmentVariable('ALEXA_APP_ID') + ".Control_List")); |
This file contains hidden or 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
async start() { | |
try{ | |
// make the connection async/await capable | |
return await asyncIt(cb => this.alexa.execute(cb)).then(result => { | |
this.context.log('result - ', result); | |
return { | |
status: 200, | |
body: result | |
}; | |
}); |
This file contains hidden or 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
constructor(context, req) { | |
this.context = context; | |
this.req = req; | |
this.alexa = alexa; | |
// setup the connection to the alexa-skill-sdk-for-azure-function library | |
this.alexa.setup({ | |
azureCtx: context, | |
azureReq: req, | |
handlers: [ |
This file contains hidden or 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
{ | |
"living_room": "amzn1.ask.device.AGE3M3...", | |
"family_room": "amzn1.ask.device.AGE3M3...", | |
"master_bedroom": "amzn1.ask.device.AGE3M3...", | |
"test": "amzn1.ask.device.AGE3M3...", | |
} |
This file contains hidden or 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
{ | |
"living_room": "A0722C70200C", | |
"family_room": 0, | |
"master_bedroom": "500959F60E3D", | |
"test": 0 | |
} |
This file contains hidden or 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
// setup array of arrays to hold info for conversion into objects later. | |
let roomArray = new Array(); | |
let deviceArray = new Array(); | |
// get info from function settings and create the array of arrays | |
for(let i=1; i <= GetEnvironmentVariable('NUMBER_OF_ROOMS'); i++){ | |
roomArray.push([GetEnvironmentVariable('ROOM_' + i + '_NAME'), GetEnvironmentVariable('ROOM_' + i + '_DTV_ADDRESS')]); | |
deviceArray.push([GetEnvironmentVariable('ROOM_' + i + '_NAME'), GetEnvironmentVariable('ROOM_' + i + '_DEVICE_ID')]); | |
}; |
This file contains hidden or 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
{ | |
"Values": { | |
"ALEXA_APP_ID": "amzn1.ask.skill.f4ee...", | |
"HOSTNAME": "192.168.1.39", | |
"PORT": "8888", | |
"USE_SSL": true, | |
"SELF_SIGNED_SSL": true, | |
"NUMBER_OF_ROOMS": 4, | |
"ROOM_1_NAME": "family room", | |
"ROOM_2_NAME": "living room", |
This file contains hidden or 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
{ | |
"id": "ESPN2", | |
"name": { | |
"value": "ESPN2", | |
"synonyms": [ | |
"ESPN 2", | |
"ESPN two", | |
"ESPN to", | |
"ESPN too" | |
] |
This file contains hidden or 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
{ | |
"id": "PAUSE", | |
"name": { | |
"value": "pause", | |
"synonyms": [ | |
"freeze" | |
] | |
} | |
} |
NewerOlder