Kodi Community Forum
Release Kanzi: Amazon Alexa skill for Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: Release Kanzi: Amazon Alexa skill for Kodi (/showthread.php?tid=254502)



Amazon Echo skill for Kodi - jouster - 2016-12-12

(2016-12-12, 22:25)jingai Wrote:
(2016-12-12, 22:12)jouster Wrote: You say you host it yourself. Do you find this easier? What do you use or recommend for this.

I have access to a raspberry pi or a NAS that can run host a server for the requirements if needed. I just need pointing in the right direction.

It's up to what you find difficult, I guess, but it's just a web server (Apache + mod_wsgi in my case). I prefer to host it locally for a number of reasons.. the biggest being that I already had the web server in place for other things, so I didn't see the need to employ another service in the middle. It's faster, I don't have to place any trust in a 3rd party, etc.

The downsides are obvious too, though: if you don't know what you're doing, it's potentially a bigger security risk than just making Kodi accessible to the outside world. You'll be maintaining it yourself, dealing with certificates yourself, etc etc.

So.. it's up to you to decide.

(2016-12-12, 22:12)jouster Wrote: I will look at my logs but I fear the results I'll see will just lead to more questions.

Not likely, actually. Either it's getting the requests or it's not. If the logs are empty, the problem is the skill set up on the dev console. If the logs aren't empty but are presenting some error, posting the error here should be enough for us to help you figure out what to do.

You can look at the screenshots in @jonjon's post above if it helps.


I'll have a dig. Thanks


Sent from my iPhone


RE: Amazon Echo skill for Kodi - Taskmaster - 2016-12-13

I had this working and I changed which Kodi installation I was using and I was updating the Custom Slots on the Echo dev console and something went wrong. The only command that works now through the test interface seems to be "go home" Below is the output when I try "play latest episode Modern Family". I'm hosting myself on a Docker container and I've rebuilt that too, but still having the same trouble.


SERVICE REQUEST
{
"session": {
"sessionId": "SessionId.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"application": {
"applicationId": "amzn1.ask.skill.XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"locale": "en-US",
"timestamp": "2016-12-13T05:13:23Z",
"intent": {
"name": "PlayLatestEpisode",
"slots": {
"Show": {
"name": "Show",
"value": "Modern Family"
}
}
}
},
"version": "1.0"
}


SERVICE RESPONSE

{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "You can ask me whether there are any new shows, to play a movie, tv show, or artist, or control playback of media."
},
"card": {
"content": "You can ask me whether there are any new shows, to play a movie, tv show, or artist, or control playback of media.",
"title": "Help",
"type": "Simple"
},
"shouldEndSession": true
},
"sessionAttributes": {}
}




I appreciate it if anyone has input what I'm missing?



EDIT - My fault (kinda knew that), did a pull but didn't update intents... All set now


RE: Amazon Echo skill for Kodi - jouster - 2016-12-13

(2016-12-12, 22:12)jouster Wrote:
(2016-12-12, 22:07)jingai Wrote:
(2016-12-12, 21:59)jouster Wrote: You say you don't personally use AWS. I am. Now wondering what you personally use.

I host it myself, but don't misunderstand: I wasn't saying AWS is a 'bad' way to host it. Was just indicating my level of experience with it.

(2016-12-12, 21:59)jouster Wrote: The links you've sent me are the exact procedure I have followed which is why I am tearing my hair out.

I have followed them to the letter and I'm still getting the endpoint issue when attempting to test in AWS.

Not trying to be rude or anything, but obviously you missed something Wink It's difficult to say where you went wrong though.

You should start by checking the Lambda logs to see if the skill is even seeing any of the requests.

(2016-12-12, 21:59)jouster Wrote: You mentioned in earlier post about pointing to my endpoint. Via a browser to see what response I get. This is where I was a little confused for now and was hoping this would at least either point to the expected result meaning I could look else where for my issue or see if there is something wrong early on.

I don't know if there's a URL you can point a browser at to test Lambda functions. I'm sorry I mislead you there.


You don't need to apologise and none of you replies are coming across as rude

The internet and chat rooms in general are so hard to communicate via at time as so much is lost in text.

You say you host it yourself. Do you find this easier? What do you use or recommend for this.

I have access to a raspberry pi or a NAS that can run host a server for the requirements if needed. I just need pointing in the right direction.

I will look at my logs but I fear the results I'll see will just lead to more questions.

I guess I may need some assistance from someone tuning this using the AWS process themselves

At the end of the day I'd rather run it locally hosted as it will (IMHO) be the better way to host it. This is how I have my KODI running in general (on a 100TB server) so I always appreciate how local data is more beneficial in some instances.


Sent from my iPhone (typie typie)


ok so after some very helpful input from @jingai I have managed to have a look at my logs...I have attached a screen grab which I have posted below (hope this is ok)

It does indeed point to an error as you can see, an "Application ID verification fail" error

Application ID verification failed: ValueError
Traceback (most recent call last):
File "/var/task/wsgi.py", line 1813, in lambda_handler
verify_application_id(appid)
File "/var/task/wsgi.py", line 1799, in verify_application_id
raise ValueError("Application ID verification failed")
ValueError: Application ID verification failed


Whilst this doesn't let me fix things on my own, it does explain why nothing is currently working. I know @jingai doesn't personally use Lambda but is anyone else aware what might be going wrong here


RE: Amazon Echo skill for Kodi - jingai - 2016-12-13

(2016-12-13, 13:03)jouster Wrote: Application ID verification failed: ValueError
Traceback (most recent call last):
File "/var/task/wsgi.py", line 1813, in lambda_handler
verify_application_id(appid)
File "/var/task/wsgi.py", line 1799, in verify_application_id
raise ValueError("Application ID verification failed")
ValueError: Application ID verification failed

You have application ID verification enabled in your .env file but the value in SKILL_APPID doesn't match your application ID. Look at dev console in the same place as the first screenshot in this section of the README. The top part there shows your application ID. You need to copy that into the SKILL_APPID environment variable in .env and re-deploy to Lambda.

If you still have trouble connecting to it, check your logs again and see what it's saying.


Amazon Echo skill for Kodi - jouster - 2016-12-13

Thanks. Will give that a try


Sent from my iPhone


RE: Amazon Echo skill for Kodi - Newu_boy - 2016-12-13

Make sure you type your address for kodi in the env file without http:\\
KODI_ADDRESS = mykodiservice.com


RE: Amazon Echo skill for Kodi - Newu_boy - 2016-12-13

You might also find you are better off stripping all configuration from AWS and starting from scratch that it might help tidying everything up. also check logs in aws cloudwatch this can also help point where the setup is wrong at the moment.


RE: Amazon Echo skill for Kodi - jouster - 2016-12-13

ok so started from screatch and entered the SkillID

I added this line into my env file

SKILL_APPID = amzn1.ask.skill.*******-052e-4606-b726-4aa2d94108df


and removed SKILL_APPID from the end of this line so this is now how the line looks in my ENV file

LAMBDA_ENV_VARS = LAMBDA_ENV_VARS = KODI_ADDRESS,KODI_PORT,KODI_USERNAME,KODI_PASSWORD



now I've run the test again and i STILL get the end point issue BUT I'm now getting a different error in my log

the report is shown below

14:22:26 /var/task/fuzzywuzzy/fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
14:22:26 warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')



Can anyone make any suggestions as to what my next step would be


RE: Amazon Echo skill for Kodi - jouster - 2016-12-13

so now when I test I'm getting some different results...none of which are working correctly though

some test now work but never return the desired result and still half the time the rest either state they are

unable to generate request for your skill and therefore have no service response

One that does seem to generate a service request is
"to play the dark knight"

but in the service response box I see

"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "Error parsing results"
},
"card": {
"content": "Error parsing results",
"title": "Playing the movie dark knight",
"type": "Simple"
},
"shouldEndSession": true


Trying to get this to work on my Echo Dot at all just results in a single low tone

I've noticed in the logs pretty much every request goes back to the same few lines of code in wsgi.py and generates the following code....this was generated when asking KODI to play a random movie

'result': KeyError
Traceback (most recent call last):
File "/var/task/wsgi.py", line 1821, in lambda_handler
return on_intent(event['request'], event['session'])
File "/var/task/wsgi.py", line 1788, in on_intent
return one_intent[1](intent_slots)
File "/var/task/wsgi.py", line 1257, in alexa_watch_random_movie
movies_array = kodi.GetUnwatchedMovies()
File "/var/task/kodi.py", line 804, in GetUnwatchedMovies
for d in data['result']['movies']:
KeyError: 'result'


Im definitely making progress but im really not sure how much


RE: Amazon Echo skill for Kodi - jingai - 2016-12-13

(2016-12-13, 16:26)jouster Wrote: and removed SKILL_APPID from the end of this line so this is now how the line looks in my ENV file

What prompted you to remove it from LAMBDA_ENV_VARS? This will bypass the verification of the appid in the skill. I mean, it will work.. I just don't know why you populated SKILL_APPID and then removed it from LAMBDA_ENV_VARS?

(2016-12-13, 16:26)jouster Wrote: 14:22:26 /var/task/fuzzywuzzy/fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
14:22:26 warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

This is not an error. It's a warning, as it says. With Lambda deployments you can't install python-Levenshtein, so it's safe for you to simply ignore it.

(2016-12-13, 16:26)jouster Wrote: 'result': KeyError
Traceback (most recent call last):
File "/var/task/wsgi.py", line 1821, in lambda_handler
return on_intent(event['request'], event['session'])
File "/var/task/wsgi.py", line 1788, in on_intent
return one_intent[1](intent_slots)
File "/var/task/wsgi.py", line 1257, in alexa_watch_random_movie
movies_array = kodi.GetUnwatchedMovies()
File "/var/task/kodi.py", line 804, in GetUnwatchedMovies
for d in data['result']['movies']:
KeyError: 'result'

The skill is unable to retrieve a list of movies from your Kodi library. This is due to not being able to establish a connection.. or incorrect username, incorrect password, wrong port number, etc.

Please don't truncate your logs. Do block out personal info, but I need to see it in its entirety if I am to help you.


RE: Amazon Echo skill for Kodi - jingai - 2016-12-13

Also, is the following how it actually appears in your .env file?

Code:
LAMBDA_ENV_VARS = LAMBDA_ENV_VARS = KODI_ADDRESS,KODI_PORT,KODI_USERNAME,KODI_PASSWORD

Notice the duplicate "LAMBDA_ENV_VARS = ".


Amazon Echo skill for Kodi - jouster - 2016-12-13

Yes I've pulled that right from the file.

I'll reinstate the skill section now and also remove that strangely unwanted section too.

Access wise I'm a little confused still as I can access the remote screen via a machine from outside the house and on any machine from within.



Sent from my iPhone


RE: Amazon Echo skill for Kodi - jingai - 2016-12-13

(2016-12-13, 17:49)jouster Wrote: Yes I've pulled that right from the file.

I'll reinstate the skill section now and also remove that strangely unwanted section too.

Heed the text in this section please:

Code:
You do not need to change the options that already have values.

You shouldn't be touching LAMBDA_ENV_VARS at all.

(2016-12-13, 17:49)jouster Wrote: Access wise I'm a little confused still as I can access the remote screen via a machine from outside the house and on any machine from within.

You being able to access it and the skill being able to access it are two entirely different things. You've got something wrong in your .env file. The error I pointed out above would prevent it from talking to Kodi, for instance.


Amazon Echo skill for Kodi - jouster - 2016-12-13

(2016-12-13, 17:53)jingai Wrote:
(2016-12-13, 17:49)jouster Wrote: Yes I've pulled that right from the file.

I'll reinstate the skill section now and also remove that strangely unwanted section too.

Heed the text in this section please:

Code:
You do not need to change the options that already have values.

You shouldn't be touching LAMBDA_ENV_VARS at all.

(2016-12-13, 17:49)jouster Wrote: Access wise I'm a little confused still as I can access the remote screen via a machine from outside the house and on any machine from within.

You being able to access it and the skill being able to access it are two entirely different things. You've got something wrong in your .env file. The error I pointed out above would prevent it from talking to Kodi, for instance.


Going to start from scratch my env file


Thanks for the pointers.


Sent from my iPhone


Amazon Echo skill for Kodi - jouster - 2016-12-13

Well starting with a fresh env file made all of the difference.

It's now working but I'm finding things quite slow depending exactly what I've asked for. It might not help that I have a huge library consisting of 60 TB of data so that might not help.

But a massive thanks for help so far @jingai in particular for persevering with me

Really appreciate it.

Using a hosting method. Is there a way to speed things up?


Sent from my iPhone