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)



RE: Amazon Echo skill for Kodi - abolton - 2016-08-06

Hey JoeyGecho - I'm getting this same error, would you be able to help me out with how you corrected it please?

Thanks!



(2016-07-05, 19:40)joeygecho Wrote: anything I ask seems to give me this error.

START RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91 Version: $LATEST
event.session.application.applicationId=amzn1.echo-sdk-ams.app.56051cba-cb04-4c14-ade0-7111e91c828a
on_session_started requestId=EdwRequestId.dec3943c-8485-4dd3-bd67-7f8c7680fbdd, sessionId=SessionId.2c133e66-a2d5-4ea3-ad15-4b38caccb4ae
on_intent requestId=EdwRequestId.dec3943c-8485-4dd3-bd67-7f8c7680fbdd, sessionId=SessionId.2c133e66-a2d5-4ea3-ad15-4b38caccb4ae
Invalid intent: ValueError
Traceback (most recent call last):
File "/var/task/index.py", line 29, in lambda_handler
return on_intent(event['request'], event['session'])
File "/var/task/index.py", line 69, in on_intent
raise ValueError("Invalid intent")
ValueError: Invalid intent

END RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91
REPORT RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91 Duration: 0.64 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 37 MB



RE: Amazon Echo skill for Kodi - abolton - 2016-08-06

Success figured out what I was doing wrong...had a TYPO in Kodi user name in the kodi.py file!!!

For the others that might run across this other type of error that I hit starting off...."Handler 'lambda_handler' missing on module 'wsgi'" Pay attention to how you are zipping your files up. I was just zipping back up the folder extracted from the download after editing the Kodi file. This creates a sub directory and thus changes the file structure. Should just be zipping the files back up and not the folder.

How I love the small things messing with me at night!

First impression using AWS are responses seem a bit better than with Heroku. Still get some errors from Alexa but think thats more due to how long Kodi is taking to load my movies.

Thanks for everyone that contributed to this awesome skill!

(2016-08-06, 04:39)abolton Wrote: Hey JoeyGecho - I'm getting this same error, would you be able to help me out with how you corrected it please?

Thanks!



(2016-07-05, 19:40)joeygecho Wrote: anything I ask seems to give me this error.

START RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91 Version: $LATEST
event.session.application.applicationId=amzn1.echo-sdk-ams.app.56051cba-cb04-4c14-ade0-7111e91c828a
on_session_started requestId=EdwRequestId.dec3943c-8485-4dd3-bd67-7f8c7680fbdd, sessionId=SessionId.2c133e66-a2d5-4ea3-ad15-4b38caccb4ae
on_intent requestId=EdwRequestId.dec3943c-8485-4dd3-bd67-7f8c7680fbdd, sessionId=SessionId.2c133e66-a2d5-4ea3-ad15-4b38caccb4ae
Invalid intent: ValueError
Traceback (most recent call last):
File "/var/task/index.py", line 29, in lambda_handler
return on_intent(event['request'], event['session'])
File "/var/task/index.py", line 69, in on_intent
raise ValueError("Invalid intent")
ValueError: Invalid intent

END RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91
REPORT RequestId: 8965069b-42d7-11e6-9432-b3a01fb2ae91 Duration: 0.64 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 37 MB



RE: Amazon Echo skill for Kodi - edru - 2016-09-09

So if anyone wants to set this up on their own, here are the full start to finish instructions. I made these after spending 2 hours pulling my hair out only to realize I was missing a python module. Primary thanks to @astro14 who had most of this put together in a small comment.

Feel free to share as needed or to add to any walkthrough/guide/even the opening post.

Install Prereqs:
Code:
sudo apt install apache2 apache2-utils libexpat1 ssl-cert python-pip libapache2-mod-wsgi git-core

Install python modules:
Code:
sudo pip install requests yaep pytz pycountry fuzzywuzzy python-Levenshtein

Sync repo to folder:
Code:
cd /var/www/html
sudo git clone https://github.com/m0ngr31/kodi-alexa.git

Modify Personal KODI info:
Code:
sudo nano /var/www/html/kodi-alexa/kodi.py

Modify the following entries to match your setup:
Code:
KODI_ADDRESS
KODI_PORT
KODI_USERNAME
KODI_PASSWORD

Enable SSL:
Code:
sudo a2enmod ssl

Create Certs: (if further help needed https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04)
Code:
sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 999 -newkey rsa:2048 -sha256 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Modify SSL Conf File:
Code:
sudo nano /etc/apache2/sites-available/default-ssl.conf

Verify DocumentRoot and add path to WSGIScriptAlias:
Code:
DocumentRoot /var/www/html
WSGIScriptAlias /kodi-alexa /var/www/html/kodi-alexa/wsgi.py

Modify the SSLCertificate paths:
Code:
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

Exit and Save

Enable the Site:
Code:
sudo a2ensite default-ssl.conf

Restart Apache:
Code:
sudo service apache2 restart

Copy contents of SSL certificate for Amazon:
Code:
nano /etc/apache2/ssl/apache.crt
(copy everything in file)

Configure Amazon Developer Portal Skill:
Follow instructions here: https://github.com/m0ngr31/kodi-alexa for most configuration walk through. Mind you that the address you use will be different, and you will need to generate your show/movie/music lists (custom slots).
Set your IP as https://YOUR_ADDRESS/kodi-alexa
SSL: paste copied cert

Save - this should do it. Even started over and followed this guide to the T and it worked for me in minutes.

EDIT: Updated 1/22/2017


RE: Amazon Echo skill for Kodi - geman220 - 2016-09-20

(2016-09-09, 05:13)edru Wrote: So if anyone wants to set this up on their own, here are the full start to finish instructions. I made these after spending 2 hours pulling my hair out only to realize I was missing a python module. Primary thanks to @astro14 who had most of this put together in a small comment.

Feel free to share as needed or to add to any walkthrough/guide/even the opening post.

Install Prereqs:
sudo apt install apache2 apache2-utils libexpat1 ssl-cert python-pip libapache2-mod-wsgi git-core

Install requests python module:
sudo pip install requests

Sync repo to folder:
cd /var/www/html
sudo git clone https://github.com/m0ngr31/kodi-alexa.git

Modify Personal KODI info:
sudo nano /var/www/html/kodi-alexa/kodi.py

Modify the following entries to match your setup:
KODI_ADDRESS
KODI_PORT
KODI_USERNAME
KODI_PASSWORD

Enable SSL:
sudo a2enmod ssl

Create Certs: (if further help needed https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04)
sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 999 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Modify SSL Conf File:
sudo nano /etc/apache2/sites-available/default-ssl.conf

Verify DocumentRoot and add path to WSGIScriptAlias:
DocumentRoot /var/www/html
WSGIScriptAlias /kodi-alexa /var/www/html/kodi-alexa/wsgi.py

Modify the SSLCertificate paths:
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

Exit and Save

Enable the Site:
sudo a2ensite default-ssl.conf

Restart Apache:
sudo service apache2 restart

Copy contents of SSL certificate for Amazon:
nano /etc/apache2/ssl/apache.crt
(copy everything in file)

Configure Amazon Developer Portal Skill:
Follow instructions here: https://github.com/m0ngr31/kodi-alexa for most configuration walk through. Mind you that the address you use will be different, and you will need to generate your show/movie/music lists (custom slots).
Set your IP as https://YOUR_ADDRESS/kodi-alexa
SSL: paste copied cert

Save - this should do it. Even started over and followed this guide to the T and it worked for me in minutes.


Not sure what I have done wrong but I get the following error: "The remote endpoint could not be called, or the response it returned was invalid."

I am able to go to HTTPS://MYURL/kodi-alexa which loads a blank page. If I try HTTPS://MYURL/kodi-alexa1 it 404s as you would expect. I have opened 443 through my router and it's forwarded to the correct local IP. I tried sudo chmod 777 wsgi.py just as a test but that didn't seem to help either. It's pretty clear that it's not talking to my local installation but I'm not sure why.

EDIT: I have a service running on port 80 but I don't think tha twould matter because all traffic should be over 443 correct?

I've done tcpdump 'port 443' and I see the inbound traffic coming to my HTTPS device but it's still not working. Not sure what the problem could be but it seems to be coming in fine and there is a handshake. I have the kodi.py configured correctly.


RE: Amazon Echo skill for Kodi - edru - 2016-09-25

(2016-09-20, 00:27)geman220 Wrote: Not sure what I have done wrong but I get the following error: "The remote endpoint could not be called, or the response it returned was invalid."

I am able to go to HTTPS://MYURL/kodi-alexa which loads a blank page. If I try HTTPS://MYURL/kodi-alexa1 it 404s as you would expect. I have opened 443 through my router and it's forwarded to the correct local IP. I tried sudo chmod 777 wsgi.py just as a test but that didn't seem to help either. It's pretty clear that it's not talking to my local installation but I'm not sure why.

EDIT: I have a service running on port 80 but I don't think tha twould matter because all traffic should be over 443 correct?

I've done tcpdump 'port 443' and I see the inbound traffic coming to my HTTPS device but it's still not working. Not sure what the problem could be but it seems to be coming in fine and there is a handshake. I have the kodi.py configured correctly.


In most cases it has something to do with either the SSL certificate, or the requirements. Check out the logs and see if you can see anything blatant. I get the blank page as well when manually surfing there. With the little bit of info given, id say make sure the SSL is correct on the amazon side, verify you have the correct info added into the kodi.py, verify the services are active on KODI itself, verify the git is synced at //var/www/html/kodi-alexa/, and then verify you added the WSGI script line (and that they actually match correctly):

DocumentRoot /var/www/html
WSGIScriptAlias /kodi-alexa /var/www/html/kodi-alexa/wsgi.py

The logs are what pointed me in the right direction as far as needing the "requests" module. Quick way to test kodi is exactly how you tested the module, just surf to the path/port being used, use the username and password, and you should be able to hit Kodi's web gui.


RE: Amazon Echo skill for Kodi - mihaiii - 2016-09-25

I get an error when i try to add the intent schema

"Error: There was a problem with your request: Unknown slot type 'MUSIC' for slot 'Artist' "


I attached the screenshot
I used copy paste so i don't think there's an error there

https://imgur.com/a/lzPf9


LE.. Found the answer.. I had to add the MUSIC / MOVIES

RTFM, Mihai Smile


RE: Amazon Echo skill for Kodi - Herr Pink - 2016-09-28

Edited: removed original post
Ignore all of this, I've figured it out.

Many thanks for the great work on this Smile


RE: Amazon Echo skill for Kodi - tmn103 - 2016-10-01

Thanks very much for this.

edit: was having problems with lambda timing out. Realised my mistake - I'd set the kodi address as internal ip address!


RE: Amazon Echo skill for Kodi - AgileHumor - 2016-10-02

Thank you so much for this addon. Was able to install it on Windows with your excellent guide.

I did get an error on the searches though:
Oct 02 00:19:36 fast-meadow-33649 app/web.1: Requested intent: DoSearch
Oct 02 00:19:36 fast-meadow-33649 app/web.1: [2016-10-02 07:19:35 +0000] [12] [ERROR] Error handling request /
Oct 02 00:19:36 fast-meadow-33649 app/web.1: Traceback (most recent call last):
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     self.handle_request(listener, req, client, addr)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     respiter = self.wsgi(environ, resp.start_response)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 851, in application
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     output = h[1](environ, start_response)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 791, in do_alexa
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     response = one_intent[1](intent_slots)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 452, in alexa_do_search
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     heard_search = str(slots['Search']['value']).lower().translate(None, string.punctuation)
Oct 02 00:19:36 fast-meadow-33649 app/web.1: KeyError: 'Search'


RE: Amazon Echo skill for Kodi - m0ngr31 - 2016-10-03

(2016-10-02, 05:19)AgileHumor Wrote: Thank you so much for this addon. Was able to install it on Windows with your excellent guide.

I did get an error on the searches though:
Oct 02 00:19:36 fast-meadow-33649 app/web.1: Requested intent: DoSearch
Oct 02 00:19:36 fast-meadow-33649 app/web.1: [2016-10-02 07:19:35 +0000] [12] [ERROR] Error handling request /
Oct 02 00:19:36 fast-meadow-33649 app/web.1: Traceback (most recent call last):
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     self.handle_request(listener, req, client, addr)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     respiter = self.wsgi(environ, resp.start_response)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 851, in application
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     output = h[1](environ, start_response)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 791, in do_alexa
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     response = one_intent[1](intent_slots)
Oct 02 00:19:36 fast-meadow-33649 app/web.1:   File "/app/wsgi.py", line 452, in alexa_do_search
Oct 02 00:19:36 fast-meadow-33649 app/web.1:     heard_search = str(slots['Search']['value']).lower().translate(None, string.punctuation)
Oct 02 00:19:36 fast-meadow-33649 app/web.1: KeyError: 'Search'

I've updated this today to fix the search!


RE: Amazon Echo skill for Kodi - AgileHumor - 2016-10-03

Thanks man! You rock!

Really well done!

PS - Tested and working.


RE: Amazon Echo skill for Kodi - litfoo - 2016-10-05

hey all,

was trying to get this working but seem to have gotten stuck towards the end of setting up Heroku

at the point, where I should have entered:

Code:
git remote add heroku https://git.heroku.com/my-appname-88888.git

I just entered

Code:
git remote add heroku https://git.heroku.com/my-appname-88888
- forgetting the .git

i then pressed enter and then ran

Code:
git push heroku master

which returned the error

Code:
c:\Kodistuff\Code\kodi-alexa>git push heroku master
remote: !       Invalid path.
remote: !       Syntax is: https://git.heroku.com/<app>.git where <app> is your app's name.
fatal: repository 'https://git.heroku.com/my-appname-88888/' not found

and if I try to enter

Code:
git remote add heroku https://git.heroku.com/my-appname-88888.git

i get

Code:
fatal: remote heroku already exists.

not sure how to get around this loop now

any help would be appreciated

thanks, litfoo


RE: Amazon Echo skill for Kodi - m0ngr31 - 2016-10-05

Code:
git remote rm heroku



RE: Amazon Echo skill for Kodi - litfoo - 2016-10-05

(2016-10-05, 22:09)m0ngr31 Wrote:
Code:
git remote rm heroku

thanks

and then start again with

Code:
git remote add heroku https://git.heroku.com/my-appname-88888.git

or back to

Code:
git clone https://github.com/m0ngr31/kodi-alexa.git



RE: Amazon Echo skill for Kodi - m0ngr31 - 2016-10-05

Just try adding the remote source again.
Code:
git remote add heroku https://git.heroku.com/my-appname-88888.git



This forum uses Lukasz Tkacz MyBB addons.