rsummers618 / HTPC_Alexa_Skill

Control Kodi Netflix and Chrome with your Amazon Echo
51 stars 24 forks source link

Intermittently Get Error "The remote endpoint could not be called, or the response it returned was invalid." #21

Open gr33k opened 7 years ago

gr33k commented 7 years ago

I finally have everything working pretty good. I add Specto Fork Movies and TV Shows to the library and they play locally. I don't know how it opts for Netflix but I got that working too on occasion.

However, after some testing I will start getting errors as if the Lambda service isn't replying (overloaded, errors?):

The remote endpoint could not be called, or the response it returned was invalid.

securisec commented 7 years ago

did you make any code changes to get specto fork to work? or does it pick it up automatically?

gr33k commented 7 years ago

Here is a bit of awesome sauce for folks as I didn't realize what "Local Library" was truly referring to.

Specto, Salts...any 3rd party application that has a "Add to Library" function will work :) I typically add favorite shows and movies to the library using several applications. I also have been adding them to the utterances file in the following formats:

Tv Shows: PlayTVIntent play {Rick and Morty|MediaName} PlayTVIntent play {Rick and Morty|MediaName} Season {SeasonNum} PlayTVIntent play {Rick and Morty|MediaName} Season {SeasonNum} Episode {EpisodeNum}

Movies: PlayTVIntent play {Avatar|MediaName} PlayTVIntent play {Suicide Squad|MediaName} PlayTVIntent play the movie {Avatar|MediaName} PlayTVIntent play the movie {Suicide Squad|MediaName}

This is not ideal for use as a wildcard unfortunately...but it gets the job done for the wife's favorite shows and a few movies I would like to be able to have it play.

My problem runs in to intermittent failures using the same exact commands that previously worked (I've been saying the same things over and over again...I wonder if the server is overloaded by all the users testing it perhaps?).

My goal would be to ideally have a walk through (if rsummers618 would be so kind and has the time please) that explains how to setup our own Lamba instance and configure the Kodi piece to communicate with our own private Lamda instances (and AWS if required). This would give us more visibility in to what may be causing server side errors/delays/etc.

I love the work done so far! I am happy and sad that rsummers618 is going to make it more directly application specific (like netflix vs going through kodi...However I got this working with Chrome launcher on FireTV by side loading netflix and chrome for Lollipop 5.0 apks)...I DO wish that the Kodi focus remains. I'd love to see it work with any 3rd party plugins vs specific ones. I can't really use Pulsar due to space constraints on FireTV and Firesticks...So Streaming is the way to go on these.

I also have a UPNP server which i haven't been able to integrate with local library support. I suspect that it may work if I try to use Lunatix Repo's Psuedo folders and some how make the UPNP files appear in the library like I am doing with Specto and other apps...

securisec commented 7 years ago

really nice work gr33k. you should do a pull request

gr33k commented 7 years ago

To provide more information:

I can do a "Hello" under the text testing area to get a successful reply:

Lambda Request:

{ "session": { "sessionId": "SessionId.c7abe908-e81d-4758-bfe9-0af7a2583d72", "application": { "applicationId": "amzn1.ask.skill.1c789d5c-4a9d-42d9-b91b-f45a618e03de" }, "attributes": {}, "user": { "userId": "amzn1.ask.account.REALLYLONGVALUETHATLOOKSLIKEMYKEYSOIREMOVEDITWITHTHISSTUFFHEHE" }, "new": true }, "request": { "type": "IntentRequest", "requestId": "EdwRequestId.0bd7bb8e-0347-4282-94c5-4aaff8284e47", "locale": "en-US", "timestamp": "2016-11-26T23:38:06Z", "intent": { "name": "PausePlayIntent", "slots": {} } }, "version": "1.0" }

Lambda Reply: { "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "Ok" }, "card": { "content": "Kodi Pause/Resumed", "title": "ARK", "type": "Simple" }, "shouldEndSession": true }, "sessionAttributes": {} }

Which looks correct. Kodi is sitting there right now not doing much.

If I do Play Avatar from testing it seems to typically work fine:

Lambda Request:

{ "session": { "sessionId": "SessionId.41545e00-6b75-4d3d-9487-d6352aed4705", "application": { "applicationId": "amzn1.ask.skill.1c789d5c-4a9d-42d9-b91b-f45a618e03de" }, "attributes": {}, "user": { "userId": "amzn1.ask.account.REALLYLONGVALUETHATLOOKSLIKEMYKEYSOIREMOVEDITWITHTHISSTUFFHEHE" }, "new": true }, "request": { "type": "IntentRequest", "requestId": "EdwRequestId.36e82c89-0c3e-4e27-91bf-1f498b90078e", "locale": "en-US", "timestamp": "2016-11-27T00:03:28Z", "intent": { "name": "PlayTVIntent", "slots": { "EpisodeNum": { "name": "EpisodeNum" }, "MediaName": { "name": "MediaName", "value": "Avatar" }, "SeasonNum": { "name": "SeasonNum" } } } }, "version": "1.0" }

Lambda Reply:

{ "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "Playing the Movie, Avatar, locally on Kodi" }, "card": { "content": "Avatar played locally", "title": "ARK", "type": "Simple" }, "shouldEndSession": true },

So...since this works - It would seem that all "Play" whatever I have (at least) explicitly defined in the utterances should ALWAYS work...but they don't...specifically from the Echo itself. Neither of my device (Alexa or Kodi) are having network connectivity issues otherwise (fwtw).

I should also add that I get a reply from Echo stating that Kodi did not respond in time (or another error...something about unexpected response...I did not write it down) - However - it DOES work. I see a minimal delay to Kodi, and then it goes through (for example) Specto source search and auto plays (per the configuration settings I've put in Specto) the best source found. The error is annoying of course, but something I can totally live with ;)

Another Issue I ran in to - I had some commands from the echo be received as "Send me my key" some how. I'm not 100% sure that when this happens, DO you have to update Kodi with the new key? I did it just in case with the last key I got and it worked better again (at some point it stopped completely it seemed). I also changed the key to one explicit phrase to prevent accidentally getting a new key again:

GetKeyIntent get a new code

It works more consistently from test console than from Echo (despite trying to be very clear in my requests to make sure it's not mishearing the titles).

Lastly, It seems that I have MORE success when I discovered "Starting the TV Services" thingy here by SOMETIMES saying "Tell Kodiiiii...." (yes like I lagged on the "eeee" sound due to thinking of what else to frakin saying lol) and it starts a MENU driven set of options! This asks for a Movie, TVShow, or Pandora (Pandora doesn't seem to work I tried a few commands so far to no avail see utterances I put below). When you say the movie or tvshow here...it seems to work BETTER than when trying to say the movie in the command itself. SADLY, this doesn't always load up the menu oddly when simply saying "Alexa Tell Kodi". Sometimes works, sometimes doesn't....seems to work better when I drag out the i sound (LoL still find that pretty funny).

Sample Pandora Utterances I am testing so far:

PlayPandoraIntent play {E forty|MediaName} PlayPandoraIntent play {Ice Cube|MediaName}

(I might need to sideload Pandora APK on the FireTV vs use Amazon APK's as the general Google ones seem to work and the Amazon do NOT work).

gr33k commented 7 years ago

Well it's been working BETTER last night...same commands same everything (showing it off to friends and neighbors hehe). It's strange as I've changed nothing, but heck I'm happy it's working so far. I also found another project which is showing promise:

https://github.com/m0ngr31/kodi-alexa