Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 23, 2022, 10:02:49 AM »
I think it is set in the command actions Kalle.

See attached:
72
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by Kalle on August 23, 2022, 03:37:49 AM »

Hi PegLeg,
do you get a confirmation via Alexa or does Alexa repeat the command?
At the moment I only get "OK" as confirmation and I am sure that she repeated the command before.
Do you know where I can set this in the code?


Kalle
73
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by PegLegTV on August 19, 2022, 05:51:56 PM »
after a lot of testing, I deleted everything and tried again. At first I was getting an error about "utterance conflict detected", it wouldn't let me use the word "off" as an utterance so I removed that from the list and the error went away. I was then able to test the skill and I'm now getting the event to show up in VoxCommando!  ::wiggle

with the short amount of testing that I've done so far I have found several words that wouldn't work to begin with so I had to add them to the utterance list. the word that I haven't gotten to work so far is "please" for example is I say "Lights Please" the event only shows "Lights" for some reason Alexa doesn't want to pass that with the event (not a big problem, I'll just need to make some changes in VC)

as for the invocation words I tried "jarvis jarvis" and "ironman ironman" both required me to say "Alexa tell jarvis jarvis play" or "Alexa tell ironman ironman play". so I thought I would see if it would let me get a way with one invocation word "jarvis", there is an error under the field that says "Invocation name must be at least 2 words." but I pressed "Save Model" button at the top of the page and then pressed Build model. I didn't receive any errors on build, but the error is still present under the invocation words field. I can now say "Alex tell jarvis play" and it works

I used the original node.js code from the tutorial and node.js version 16.

I'll be doing more testing on words and phrase to find what words need to be added to the utterance list but this is a great start in the right direction

Thank you, you guys are always a huge help. (especially because it seems I messed something up the first time around  :bonk ::saddest)


74
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by Kalle on August 19, 2022, 04:36:04 AM »

Now at least it works again.
The problem was my DDNS account, which had not updated the IP address.

@PegLeg: Like you, I changed the invocation name, but I never say the second word, otherwise Alexa always replies with "a problem with your skill.... blah, blah, blah".
It was pure coincidence that I noticed this, because I had not yet become accustomed to the second word.
In other words: If your first phrase is currently "Iron" and "Man" is your second phrase - try "Alexa, tell Iron lights please" - if it works, you can set your invocation name to Jarvis Jarvis or ironman ironman, so that the invocation name rule is met, but always speak only the first phrase to Alexa.


I know it sounds strange, but it worked for me and maybe for you too.


Kalle
75
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 18, 2022, 06:18:04 PM »
Maybe you can use the two words Jar and Viss ?

I upgraded to node.js 12 and it still seems to be working.
76
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by PegLegTV on August 18, 2022, 01:34:17 PM »
hey jitterjames, nice to here from you too  ;D.

I'll take a look at the script and see what I can figure out.

one big change that I'm not a fan of is that the Invocation name now has to be two words, that will make commands a bit more of a mouth full... Alexa tell iron man lights please, Alexa tell iron man play random episodes of future man

please don't upgrade to test it out, I don't want to break your setup.  :bigno ::saddest

good luck with your home sale and enjoy your long weekend
77
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 18, 2022, 01:01:54 PM »
Also, I'm still using node.js version 10.  I'm not sure if I upgrade if it will keep working...
78
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 18, 2022, 12:58:59 PM »
Also...

Hi Pegleg.  It's nice to hear from you!  :biglaugh
79
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 18, 2022, 12:57:58 PM »
Here is my lambda code.  Note that there are a bunch of environment variables that need to be set or you can just replace them with your own values directly in the code.

Look in the code for process.env.VARNAME

Code: [Select]
/*
****** Pulls speech input and passes on to Voxcommando for custom events *****
*/
var http = require('http');
var Echo_App_ID = "amzn1.ask.skill.3bee3d22-3eb3-4282-4df7-925fc8111b2e"; 

exports.handler = function (event, context) {
    try {
        if (event.session.new) {
            onSessionStarted({requestId: event.request.requestId}, event.session);
        }
        if (event.request.type === "LaunchRequest") {
            onLaunch(event.request,
                     event.session,
                     function callback(sessionAttributes, speechletResponse) {
                        context.succeed(buildResponse(sessionAttributes, speechletResponse));
                     });
        }  else if (event.request.type === "IntentRequest") {
            onIntent(event.request,
                     event.session,
                     function callback(sessionAttributes, speechletResponse) {
                         context.succeed(buildResponse(sessionAttributes, speechletResponse));
                     });
        } else if (event.request.type === "SessionEndedRequest") {
            onSessionEnded(event.request, event.session);
            context.succeed();
        }
    } catch (e) {
        context.fail("Exception: " + e);
    }
};

/**
 * Called when the session starts.
 */
function onSessionStarted(sessionStartedRequest, session) {}

/**
 * Called when the user launches the skill without specifying what they want.
 */
function onLaunch(launchRequest, session, callback) {
    // Dispatch to your skill's launch.
    getWelcomeResponse(callback);
}

/**
 * Called when the user specifies an intent for this skill.
 */
function onIntent(intentRequest, session, callback) {
    var intent = intentRequest.intent,
    intentName = intentRequest.intent.name;
    callEchoToVC(intent, session, callback); // Whatever the Intent is, pass it straight through to VC
}

/**
 * Called when the user ends the session.
 * Is not called when the skill returns shouldEndSession=true.
 */
function onSessionEnded(sessionEndedRequest, session) {
}

// --------------- Main Intent Processing Function ----------------

function callEchoToVC(intent, session, callback)
{
    var sessionAttributes = "{}";
    var cardTitle = "VoxCommando";
    var shouldEndSession = true;

    var payload = "";
    var speechOutput = "error maybe?";
    var repromptText = "...";
    var i = 0;
    var slots = intent.slots;
   
    //Pull the spoken text and format
    var actionSlot = intent.slots.Action;
    var setAction = actionSlot.value.toLowerCase();
   
    if (setAction.endsWith(" only"))
    {
        shouldEndSession=true;
        setAction = setAction.replace(" only","")
       
    }
   
    if(process.env.phrases_cancel.includes(setAction))
    {
        speechOutput ="Cancelling";
        shouldEndSession=true;
        callback(sessionAttributes, buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));
        return;
    }
    else if (setAction.length<5)
    {
        speechOutput =process.env.tts_tooshort;
        shouldEndSession=false;
        callback(sessionAttributes, buildSpeechletResponse("Action string too short", speechOutput, repromptText, shouldEndSession));
        return;
    }
    setAction = setAction.replace("1st","first")
    .replace("2nd","second")
    .replace("3rd","third")
    .replace("4th","fourth")
    .replace("5st","fifth")
    .replace("6th","sixth")
    .replace("7th","seventh")
    .replace("8th","eighth")
    .replace("9th","nineth")
    .replace("10th","tenth")
    ;
   
    var setActionURI = require('querystring').escape(setAction);
    var VC_uri = '/api/VC.TriggerEvent&&EchoToVC&&' + setActionURI;
    var get_options = {
            host: process.env.ip,
            port: process.env.port,
            path: VC_uri
        };
    if (process.env.username !== '')
    {
        get_options = {
            host: process.env.ip,
            port: process.env.port,
            path: VC_uri,
            headers: {
                'Authorization': 'Basic ' + new Buffer.from(process.env.username + ':' + process.env.pwd).toString('base64')
            }
        };
    }
 
    // Set up the request
    var get_req = http.request(get_options, function(res) {
        var VC_results = "";
        res.setEncoding('utf8');
        res.on('data', function (chunk) {
            VC_results += chunk;
        });
       
        res.on('end', function () {
            //console.log(VC_results);
            cardTitle = VC_results;
            console.log(VC_results);
            if (res.statusCode === 200) {
                //Parse the Body results from VC, if the command was unknown we will repromt
                if(VC_results.indexOf('<Success>False') > -1) {
                    cardTitle = "Vc error: ";
                    speechOutput = "VoxCommando API error: "+setAction;
                    repromptText = "Try again or say cancel.";
                    shouldEndSession=false;
                }
                else
                {
                    var regex = /<WebResponse>([\s\S]*?)</;
                    var reMatches = VC_results.match(regex);
        if (reMatches)
        {
        var speechOutput = reMatches[1];
        }
                    else speechOutput = "I suck";
                }
            }
            callback(sessionAttributes,
                buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession)); //Pass stingResult instead of speechOutput for debugging if needed
        });
    });
    get_req.on('error', function (e) {
        shouldEndSession=true;
        callback(sessionAttributes,
            buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));
    });
    get_req.end();   
}

// --------------- WelcomResponse Function ----------------

function getWelcomeResponse(callback) {
    // If we wanted to initialize the session to have some attributes we could add those here.
    var sessionAttributes = {};
    var cardTitle = "Welcome to Echo To Voxcommando";
    var speechOutput = "You see a smaller Jarvis in there.";

    // If the user either does not reply to the welcome message or says something that is not
    // understood, they will be prompted again with this text.
    var repromptText = "Do you speak English?";
    var shouldEndSession = false;
    callback(sessionAttributes,
             buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));
}

// --------------- Helper Functions ----------------

function buildSpeechletResponse(title, output, repromptText, shouldEndSession) {
    return {
        outputSpeech: {
            type: "PlainText",
            text: output
        },
        card: {
            type: "Simple",
            title: "EchoToVoxcommando - " + title,
            content: output
        },
        reprompt: {
            outputSpeech: {
                type: "PlainText",
                text: repromptText
            }
        },
        shouldEndSession: shouldEndSession
    };
}

function buildResponse(sessionAttributes, speechletResponse) {
    return {
        version: "1.0",
        sessionAttributes: sessionAttributes,
        response: speechletResponse
    };
}
80
VoxCommando Basics and Core Features / Re: Echo Dot Integration 2018
« Last post by jitterjames on August 18, 2022, 12:44:45 PM »
I am still using Alexa with VoxCommando and it's working.  I'm a bit busy at the moment because we are selling our house and we will be away for a long weekend.

But give me a poke on Tuesday and I'll try to make some time to help you figure this out.
Pages: 1 ... 6 7 [8] 9 10