bklavet / Echo-skill-to-control-Directv

amazon echo skill that will control a networked Directv Receiver so that users can control Directv with their voice
18 stars 67 forks source link

Failed Request Alexa Response #10

Closed cactus11 closed 7 years ago

cactus11 commented 7 years ago

I was wondering if maybe I was doing something wrong. I'm trying to get Alexa to respond when making a bad request. As an example, "ask directv to go to moon"

{ "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "do it yourself" }, "shouldEndSession": true }, "sessionAttributes": {}

As you can see above, I changed the index response to a few different things and none of them are actually vocalized by the Echo. I wasn't sure if this was something that could be done and I am just making changes in the wrong place or if this can't be done. Sorry if this is a silly question, I'm a networking guy and not a coding guy.

bklavet commented 7 years ago

If right now you are getting the " I didn't understand", then you can change that in the code to whatever you prefer, it would be the default response down at the bottom of the index file.

vmweaver commented 7 years ago

Exactly...just change this text to whatever you want...

         default:
                    if (intent.slots.Channel.value == null) {
                     response.tell("*I didn't understand.*");
                  }
            break;

On Tue, Sep 20, 2016 at 8:22 PM, B money notifications@github.com wrote:

If right now you are getting the " I didn't understand", then you can change that in the code to whatever you prefer, it would be the default response down at the bottom of the index file.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bklavet/Echo-skill-to-control-Directv/issues/10#issuecomment-248484121, or mute the thread https://github.com/notifications/unsubscribe-auth/ACibPXE_aDAJBE9K2MXLut5P8DzDYEozks5qsIbCgaJpZM4KCS59 .

cactus11 commented 7 years ago

I'm actually getting no response on a "failed" query. So if I ask Alexa to go to "moon" which is not part of any of the strings, I get silence, I'm not actually getting any audible answer back. Below is the copy out of the index file that I currently have loaded in Lambda

efault:

                    if (intent.slots.Channel.value == null) {
                     response.tell("I didn't understand.");
                  }
                    else {
                     path = '/tv/tune?major=' + intent.slots.Channel.value  ;
                  }     
            break;

    } 
    var options = {
                 host: local_ip,
                 port: 3000, // default port for DTV interface

I'm assuming that this line: response.tell("I didn't understand."); is what would dictate the response for a bad or unknown request (i.e., go to "moon") but I'm actually getting no response at all from Alexa.

Side note - excellent work on this, very easy to implement and really the hardest part was getting around my ISP and their silly incoming port restrictions.

bklavet commented 7 years ago

If the if statement is screwing up the response that could be altered to something like this.... maybe

              if (intent.slots.Channel.value == !nan) {

                 path = '/tv/tune?major=' + intent.slots.Channel.value  ;

              }
                else {
                response.tell("I didn't understand.");}     
        break
bklavet commented 7 years ago

What I am going for there is an if statement that if the Channel value is a number, change the channel to that number, otherwise give the fail response. Not a 100% on the !nan, but something like that should work.

vmweaver commented 7 years ago

Are your sample utterance and intent schema configs setup properly?

Do normal operations work okay for you?

On Tue, Sep 20, 2016 at 8:40 PM, B money notifications@github.com wrote:

If the if statement is screwing up the response that could be altered to something like this.... maybe

          if (intent.slots.Channel.value == !nan) {

             path = '/tv/tune?major=' + intent.slots.Channel.value  ;

          }
            else {
            response.tell("I didn't understand.");}
    break

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bklavet/Echo-skill-to-control-Directv/issues/10#issuecomment-248486862, or mute the thread https://github.com/notifications/unsubscribe-auth/ACibPYblgAhqznjVcNnhEj_mdNO93Jpcks5qsIr4gaJpZM4KCS59 .

bklavet commented 7 years ago

If that works i'll change the index to reflect that, I like this better if it works

vmweaver commented 7 years ago

I think it would be:

if (! isNaN(intent.slots.Channel.value) ) {

             path = '/tv/tune?major=' + intent.slots.Channel.value  ;

          }
            else {
            response.tell("I didn't understand.");}
    break

On Tue, Sep 20, 2016 at 8:44 PM, B money notifications@github.com wrote:

What I am going for there is an if statement that if the Channel value is a number, change the channel to that number, otherwise give the fail response. Not a 100% on the !nan, but something like that should work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bklavet/Echo-skill-to-control-Directv/issues/10#issuecomment-248487430, or mute the thread https://github.com/notifications/unsubscribe-auth/ACibPW8nVWSlnApUyI88c3KiOXwQO9ouks5qsIvqgaJpZM4KCS59 .

bklavet commented 7 years ago

That looks a lot better mawrew19!

another approach to try might be: if (intent.slots.Channel.value =>1) {

             path = '/tv/tune?major=' + intent.slots.Channel.value  ;

          }
            else {
            response.tell("I didn't understand.");}     
    break

If the Channel has a value that is greater or equal to 1 it should use the path, else the error message. Cactus11 let us know what worked and I will update the index accordingly!

Awesome!

vmweaver commented 7 years ago

You may be able to see what is going on in the LogWatch section of the AWS Lambda service. I haven't looked too much into it, but I believe that could be helpful.

On Tue, Sep 20, 2016 at 9:10 PM, B money notifications@github.com wrote:

That looks a lot better mawrew19!

another approach to try might be: if (intent.slots.Channel.value =>1) {

         path = '/tv/tune?major=' + intent.slots.Channel.value  ;

      }
        else {
        response.tell("I didn't understand.");}
break

If the Channel has a value that is greater or equal to 1 it should use the path, else the error message. Cactus11 let us know what worked and I will update the index accordingly!

Awesome!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bklavet/Echo-skill-to-control-Directv/issues/10#issuecomment-248491162, or mute the thread https://github.com/notifications/unsubscribe-auth/ACibPdjRCQjpkTHjbOsWbxDUdOlN2vW6ks5qsJIDgaJpZM4KCS59 .

bklavet commented 7 years ago

all, I just loaded up the index with mawrew19 and it works! I put in a bogus non number request and got the expected "I didn't understand" from lambda. Cactus11 can you confirm that this worked for you aswell?

bklavet commented 7 years ago

updated the index file in the custom slot folder. Thanks again mawrew19.

cactus11 commented 7 years ago

just made those tweaks and it is working. Thank you both very much. To the earlier question, all of the day to day functionality was working perfectly fine. Thank you both and excellent work on this.

bklavet commented 7 years ago

That is Great! Cactus11 mawrew19 is the hero behind it, he figured out what I could not, and most of the flow is from another great mind Alan Cone, who put out a sweet skill on controlling his Roku. I have been getting a few comments on you tube with people having trouble with ISP's blocking port 8080. I see you are using 3000 If you would like to throw together a summary of how you accomplished this, I would be interested, as would others I am sure.

vmweaver commented 7 years ago

Good news!!!

Most home routers, nowadays, support port translation. I will be putting together a blog post on how I setup an nginx server on an RPi that has a simple API Proxy running. I then have a NAT rule on my router that translates inbound requests on a specific port to the address of my RPi. I have done this to force it to use HTTPS and basic authentication.

Have a lot going on right now, but have committed to getting something together.

bklavet commented 7 years ago

Looking forward to seeing it. Thanks

From: mawrew19 [mailto:notifications@github.com] Sent: Tuesday, September 20, 2016 9:59 PM To: bklavet/Echo-skill-to-control-Directv Echo-skill-to-control-Directv@noreply.github.com Cc: B money brianklavetter@msn.com; Comment comment@noreply.github.com Subject: Re: [bklavet/Echo-skill-to-control-Directv] Failed Request Alexa Response (#10)

Good news!!!

Most home routers, nowadays, support port translation. I will be putting together a blog post on how I setup an nginx server on an RPi that has a simple API Proxy running. I then have a NAT rule on my router that translates inbound requests on a specific port to the address of my RPi. I have done this to force it to use HTTPS and basic authentication.

Have a lot going on right now, but have committed to getting something together.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bklavet/Echo-skill-to-control-Directv/issues/10#issuecomment-248497752, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AI6bKMVdQzRJQChDP01ujr-hDZet-hlHks5qsJ19gaJpZM4KCS59.