Author Topic: lja's special echo thread  (Read 5951 times)

0 Members and 1 Guest are viewing this topic.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: lja's special echo thread
« Reply #15 on: April 06, 2017, 10:17:25 PM »
Above James suggested that you follow the standard VC problem-solving procedure of reviewing your VC history window to diagnose what is happening after you give a voice command to Alexa. What do you see in that history log?

You should be able to see exactly what commands VC has received from the Echo (if it has indeed received any). Do you see any sign of Alexa activity in the history window? If so, do the command strings that appear in that history match the command phrases in your command tree? You don't confirm or address this in your post.

The steps for helping to resolve this problem are the same as always. As a reminder:

http://voxcommando.com/mediawiki/index.php?title=Getting_support

At the very least we'd need to see your VoxCommando log capturing your attempts to issue multiple commands, so that we can see what is or is not happening.

Without really knowing enough to say anything concrete, to me it doesn't sound like any commands are working. If you followed James's instructions exactly, then telling Alexa to "Cancel" is most likely instructing the Echo device to stop sending messages to VoxCommando entirely.

The environment variable phrases for canceling a command that he posted were "cancel", "stop", or "shut up":




What microphone do you typically use when issuing VC voice commands? Is it possible that some other microphone is also enabled and it heard you first issue the "open Kodi" command, and that's why that first command worked?



« Last Edit: April 06, 2017, 10:21:51 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: lja's special echo thread
« Reply #16 on: April 07, 2017, 07:37:34 AM »
The most efficient starting point for trying to resolve the problem at this point is to review each of James's instructional steps again to make sure each has been properly implemented.

His instructions are here: http://voxcommando.com/forum/index.php?topic=2682.msg23144#msg23144

These included:

2. Have VC version 2.2.3.4 or later installed.

3. Create the  environment variables, as described, by re-accessing the web page for the "Jarvis" function that you initially created in the AWS console.

4. Make sure the username and password used in your environment variables matches the username and password you created in VoxCommando's TCP plugin settings.

5.  On the same web page in the AWS console, replace the entire Node.js lambda code that Dave originally provided with the code that James attached to his post (link above). *important* you must change one line at the beginning of James's code near line 5:

Code: [Select]
edit one line in that script  var Echo_App_ID = "amzn1.ask.skill...." to use your own App ID.
Make sure your App ID has quotation marks around it, as in the example provided.

6. In VoxCommando, delete the old command group from Dave's original instructions and replace it with the VC command XML in James's post.
« Last Edit: April 07, 2017, 07:41:10 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: lja's special echo thread
« Reply #17 on: April 07, 2017, 01:17:25 PM »
You may also see useful troubleshooting information in the Amazon app itself.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #18 on: April 07, 2017, 01:46:23 PM »
@nime5ter
@jitterjames

Thanks. However it looks like I also have another challenge to solve first.

https://www.dropbox.com/s/d2xgd18dvktvwmn/json.jpg?dl=0
« Last Edit: April 07, 2017, 01:52:54 PM by lja »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: lja's special echo thread
« Reply #19 on: April 07, 2017, 01:57:19 PM »
Good luck with that.  ;)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #20 on: April 09, 2017, 06:36:50 PM »
Good luck with that.  ;)

Thanks. An update. Making some progress.Some movies play. Seems to be an understanding issue with the title. The history sometimes shows the title correctly but the movie does not play. However I am presently trouble shooting. Will post again with any discovery.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: lja's special echo thread
« Reply #21 on: April 10, 2017, 04:09:11 AM »
Hi lja,

I'm not sure if you use the "echosim" or the real Amazon Echo/Dot, but in the Amazon App you will find a history in settings what "Alexa" has understand. The most issue with Alex is how they spelling words - here an example from my side:

I have a command in VC which switch LEDs on, so my command was: "Alexa, tell Voxcommando to switch LED ON" which doesn't work. After a look in the VC history, I noticed that "Alexa" recognized and interpreted the word LED as  l. e. d.
So I can only repeat what James suggest before - get sure that the command what "Alexa" has recognized hit EXACTLY the command what you use in Voxcommando.

"Alexa" is a funny toy to play with, but you will never reach the flexibility of the speech recognition as it possesses VoxCommando.
***********  get excited and make things  **********

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #22 on: April 10, 2017, 12:54:02 PM »
@Kalle

Thanks. Actually, that is the process I am going through.  I am using my Echo Dot.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: lja's special echo thread
« Reply #23 on: April 11, 2017, 09:16:00 AM »
If you still need help with this I think it will be easier to help you one on one using TeamViewer. Contact me privately to set that up if you are interested.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #24 on: April 11, 2017, 12:39:50 PM »
If you still need help with this I think it will be easier to help you one on one using TeamViewer. Contact me privately to set that up if you are interested.

Thanks. Interested. Sent a test PM.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #25 on: April 12, 2017, 09:00:33 PM »
@jitterjames

Thanks. All working good so far. During the testing we set VC to off. Should VC be on as usual?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: lja's special echo thread
« Reply #26 on: April 12, 2017, 10:21:15 PM »
James turned VC off to ensure that only Alexa was listening and responding to voice commands while you were running your tests, rather than any other microphone input that may have been plugged into your computer.

If you plan to only use Alexa, then keeping VC in off mode is the safe option. But any time you want to use a proper microphone input to talk directly to VC then you'll have to turn VC back on (or use it in standby mode, depending on your preference).
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: lja's special echo thread
« Reply #27 on: April 12, 2017, 11:32:58 PM »

Thanks.
« Last Edit: April 13, 2017, 08:34:14 AM by jitterjames »

horstdog

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 1
    • View Profile
    • 1Home1PC
Re: lja's special echo thread
« Reply #28 on: February 11, 2018, 10:20:34 AM »
Hi Guys
I know this is an old thread but thought it would be best to have this quote for reference.

I just recently got an Amazon Echo dot and followed the recreated tutorial  ((http://voxcommando.com/forum/index.php?topic=2761.0) to get it working with VoxCommando. It works fine but after reading this threads and watching some other YouTube videos I'm now thinking the code from the recreated tutorial is not the new code James created but instead the original code Dave created.

If I'm correct can someone post the new code James created (Node.js lambda code + VC command XML)

My apologizes if this is found in another thread but i didn't see it.

Thank You


The most efficient starting point for trying to resolve the problem at this point is to review each of James's instructional steps again to make sure each has been properly implemented.

His instructions are here: http://voxcommando.com/forum/index.php?topic=2682.msg23144#msg23144

These included:

2. Have VC version 2.2.3.4 or later installed.

3. Create the  environment variables, as described, by re-accessing the web page for the "Jarvis" function that you initially created in the AWS console.

4. Make sure the username and password used in your environment variables matches the username and password you created in VoxCommando's TCP plugin settings.

5.  On the same web page in the AWS console, replace the entire Node.js lambda code that Dave originally provided with the code that James attached to his post (link above). *important* you must change one line at the beginning of James's code near line 5:

Code: [Select]
edit one line in that script  var Echo_App_ID = "amzn1.ask.skill...." to use your own App ID.
Make sure your App ID has quotation marks around it, as in the example provided.

6. In VoxCommando, delete the old command group from Dave's original instructions and replace it with the VC command XML in James's post.




jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: lja's special echo thread
« Reply #29 on: February 11, 2018, 11:47:27 AM »
Here is the lambda code but you need more than just the code so read my following posts.

Also remember to put your Echo_App_ID on line 5.

Code: [Select]
/*
****** Pulls speech input and passes on to Voxcommando for custom events *****
*/
var http = require('http');
var Echo_App_ID = "PUT.YOUR.OWN.ID.HERE"; 

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 = false;

    var payload = "";
    var speechOutput = "OK";
    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(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;
            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>(.*?)</;
                    var reMatches = VC_results.match(regex);
        if (reMatches)
        {
        var speechOutput = reMatches[1];
        }
                    else speechOutput = "no matches";
                }
            }
            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
    };
}
« Last Edit: February 11, 2018, 12:01:07 PM by jitterjames »