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 - T800 - 2017-02-17

It's working now


RE: Amazon Echo skill for Kodi - digiltd - 2017-02-18

(2017-02-17, 23:49)T800 Wrote: It's working now

Did you do anything different to get it working?

If you have a large number of slots it will take a long time to build the Skill. Try reducing them, especially if you have have thousands, you might be able to get away with a hundred or so for each.


RE: Amazon Echo skill for Kodi - jingai - 2017-02-18

@digiltd, should probably suggest ~500 or so. 200 doesn't appear to be a magic number, and if we suggest to people in here that they use some number potentially below whatever the threshold is for converting the slot to generic, the fuzzy matching won't kick in.. which will lead to some confusing support requests Smile


RE: Amazon Echo skill for Kodi - jingai - 2017-02-18

...further, in my opinion, until we have conclusive evidence one way or another, I'd really suggest people only bother trimming slots down to whatever is required to make it Save.

For me, personally, having more in the slots certainly helps and it will definitely speed it up.

This is definitely something we need to pin down, but I think it's premature to make a definitive statement about it.


RE: Amazon Echo skill for Kodi - digiltd - 2017-02-18

ahh, but that is why I always include the disclaimer "you might be able to get away with... " Smile

For me, I created the data ages ago, with only 130 movies and 36 shows. I haven't generated new slot data since, but it still seems to understand when I want to play new media that gets added to my library. Though I do always throw in the clarinet "movie or tv show" when I use a command,

For some of my other Skills I just have a set of phrases that I use when I need a catch all. e.g. I have a Skill where I tell Alexa to type a phrase or word into the Kodi or Squeezebox search, I say the phrase, she repeats it to confirm and then sends it via mqtt and it gets pasted in. I use 17 generic example phrases as the custom slot data and it will pass whatever I say usually. It doesn't always get them right, but that is more of a general Alexa issue.


RE: Amazon Echo skill for Kodi - jingai - 2017-02-18

But it does not do turn generic for me with so few items in the slots. So, I don't think it's a good idea to suggest it to others until we get it figured out definitively.


RE: Amazon Echo skill for Kodi - digiltd - 2017-02-18

I don't see the harm in suggesting it to someone who is having trouble and reporting having to wait 20 minutes for it to eventually crash on them. There has been at least one success story. Smile


RE: Amazon Echo skill for Kodi - T800 - 2017-02-18

(2017-02-18, 00:50)digiltd Wrote:
(2017-02-17, 23:49)T800 Wrote: It's working now

Did you do anything different to get it working?

If you have a large number of slots it will take a long time to build the Skill. Try reducing them, especially if you have have thousands, you might be able to get away with a hundred or so for each.

I just started it over again. This morning I edited mine and added 2500 songs to it no problem.


RE: Amazon Echo skill for Kodi - T800 - 2017-02-18

(2017-01-27, 18:14)rmohsen Wrote:
(2017-01-27, 17:57)jingai Wrote:
(2017-01-27, 17:14)rmohsen Wrote: I use " Alexa , ask Kodi to play movie fences " it didn't work but i tried again after my post and worked with " Die Hard " basic commands working fine , play , pause and navigation but music or videos doesn't work at all. Worked a couple of times with certain movies and shows.

How many movies do you have in your MOVIES slot?

Could you try "Alexa, ask Kodi to watch movie Fences"? It should work with "play movie" too, but let's see if you get different results with "watch movie".


Thanks a lot , it worked better with " watch movie " but I get different responses , sometimes video is not supported on this device , other times Alexa can't find the skill or just no reply at all. Same with TV shows and music. I have around 1300 movie in my library

Mine is actually working now but I often get this problem too as it think the movies and music should come from amazon. Maybe a UK thing?

I do find I'm getting different responses talking to the Echo than I do typing in the service simulator. If I type "ask kodi to navigate right" it does it on the TV and it's successful. If I verbally ask kodi to navigate right it says "I'm not quite sure how to help you with that"

I can say verbally "Echo, ask Kodi to play movie The Terminator" The first two times it says something about the video not being supported on this device and on the third it plays the movie

EDIT:
I've just now changed the Invocation Name from "cody" to "kodi" and now it navigates fine and it plays now without an issue so far. It's working much better!


RE: Amazon Echo skill for Kodi - T800 - 2017-02-18

Kaffeine doesn't work for me it just says " Something went wrong." with a thumbs down


RE: Amazon Echo skill for Kodi - popy - 2017-02-18

Guys, I have implemented pvr tv channel switching into pre 2.5 [WINKING FACE]

Sadly I have not much spare time to make pull requests.

Should ill upload the changed files anywhere?

They can be easily compared merged with beyond compare or similar.

pOpY

Gesendet von meinem LG-H815 mit Tapatalk


Amazon Echo skill for Kodi - digiltd - 2017-02-18

(2017-02-18, 11:37)T800 Wrote:
(2017-01-27, 18:14)rmohsen Wrote:
(2017-01-27, 17:57)jingai Wrote: How many movies do you have in your MOVIES slot?

Could you try "Alexa, ask Kodi to watch movie Fences"? It should work with "play movie" too, but let's see if you get different results with "watch movie".


Thanks a lot , it worked better with " watch movie " but I get different responses , sometimes video is not supported on this device , other times Alexa can't find the skill or just no reply at all. Same with TV shows and music. I have around 1300 movie in my library

Mine is actually working now but I often get this problem too as it think the movies and music should come from amazon. Maybe a UK thing?

I do find I'm getting different responses talking to the Echo than I do typing in the service simulator. If I type "ask kodi to navigate right" it does it on the TV and it's successful. If I verbally ask kodi to navigate right it says "I'm not quite sure how to help you with that"

I can say verbally "Echo, ask Kodi to play movie The Terminator" The first two times it says something about the video not being supported on this device and on the third it plays the movie

EDIT:
I've just now changed the Invocation Name from "cody" to "kodi" and now it navigates fine and it plays now without an issue so far. It's working much better!


Don't forget to go through your command history is the Alexa app (settings>history) and see what she thinks you are saying. But more importantly let her know yes or no when asked if she did what you wanted or heard you correctly. She uses that data to better understand your voice.


Sent from my iPhone


Amazon Echo skill for Kodi - digiltd - 2017-02-18

(2017-02-18, 15:19)popy Wrote: Guys, I have implemented pvr tv channel switching into pre 2.5 [emoji6]

Sadly I have not much spare time to make pull requests.

Should ill upload the changed files anywhere?

They can be easily compared merged with beyond compare or similar.

pOpY

Gesendet von meinem LG-H815 mit Tapatalk


Git is daunting but once you grasp the basics you will get what all the fuss is about Smile

Try https://guides.github.com/activities/hello-world/

This isn't really the place for a git introduction but I can try to help answer any questions via pm








Sent from my iPhone


RE: Amazon Echo skill for Kodi - T800 - 2017-02-19

Can anyone advise how I get heroku app.com to start awake? I've tried two different websites (including kaffeine) and both act as if the address doesn't work but it must do for the Echo to work.


RE: Amazon Echo skill for Kodi - Gregg The Bakers - 2017-02-19

When I started writing this reply, I was in desperate need of some help. However, by writing every step (which I was intending to use as a way for others to debug what I have done wrong), Kodi-Alexa is now working for me = yay!! For everyone's benefit (including my future self), I have written down an exhaustive "idiot's guide', in the hope others might find this useful.

STEP 1: Kodi box, home network and external access:
1/. Enable remote control via HTTP in KODI (my copy of KODI is part of OpenELEC and has been installed on a RPI2). The port chosen was 8040, username was 'kodi', and the password was 'password'.
2/. On my router, I have port forwarded the (static) IP address for RPI2 and internal port 8040 to external port 8041
3/. I have registered with ddns.net and have a valid URL. For the purposes of this explanation the URL is http://blah.ddns.net. It is worthwhile checking this URL+port combo is accessible from outside your network. Ask a friend or use your 3G/4G smart phone to test whether or not you get the KODI web-gui.

STEP 2: User and Role setup:
4/. Logon to https://console.aws.amazon.com/iam/home
5/. Click on 'Users' on the dashboard (left hand side) and click on 'Add user'
6/. Set user name to 'kodiuser'
7/. Select the 'Programmatic access' access type, before clicking on the 'Next: Permissions' button
8/. (A bit different to the supplied instructions) Click on the 'Attach existing policies directly' button
9/. Find and select 'AWSLambdaFullAccess' before clicking on the 'Next: Review' button
10/. Click on the 'Create User' button and then the close button
11/. Click on 'kodiuser' in the username list, and then select the 'Security credentials' tab
12/. Click on 'create access key'
13/. Make a note of the access key ID and secret access key, which for the purposes of this explanation are:
Quote:Access key ID : ABCDEFGHIJKLMNOPQRST
Secret access key: 1234567890abcdefghijklmnopqrstuvwxyz1234
14/. Click on 'Roles' on the dashboard (left hand side) and click on 'Create New Role'
15/. Set role name to lambda, then click on 'Next Step'
16/. Select 'AWS Lambda', then find and select 'AWSLambdaFullAccess' before clicking on 'Next Step' and then 'Create Role'
17/. Make a note of the 'role ARN' which for the purposes of this explanation are:
Quote:Role ARN : arn:aws:iam::123456789012:role/lambda

STEP 3: Setting up Lambda code:
18/. For me, Python on Windows did not work so I used an existing Ubuntu 16.10 VirtualBox machine (from within Windows) instead. Start the virtual machine.
19/. Open a terminal inside Ubuntu
20/. wget https://github.com/m0ngr31/kodi-alexa/archive/master.zip (downloaded on 19th February 2017)
21/. unzip master.zip
22/. cd kodi-alexa-master
23/. cp .env.lambda .env
24/. Edit the newly created .env file, the contents of which are now (note the URL used for my RPI2 (KODI_ADDRESS) does not have the leading http. Also, I live in England hence why I have chosen 'eu-west-1' as my default AWS region. If you live in America, you might want to choose the American option, noting there will be a few minor differences in the rest of this Idiot's guide (e.g. sub-step 30)):
Code:
# The Kodi webserver only supports HTTP.
# Uncomment KODI_SCHEME to tell the skill to use https between AWS and your local network
# (only use if you have already set this up with your own certificates)
#
# KODI_SCHEME = https

# If using a reverse proxy you might need to add an extra bit to the url before "jsonrpc"
# You can do this with KODI_SUBPATH (don't use slashes before or after)
#
# KODI_SUBPATH =

KODI_ADDRESS = blah.ddns.net
KODI_PORT = 8041
KODI_USERNAME = kodi
KODI_PASSWORD = password

SKILL_APPID =

# Your local time zone for responses that include absolute times.
# See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
#
# For example, if you are in the Eastern US time zone, you would use:
# SKILL_TZ = US/Eastern
#
# Leave empty or undefined (commented out) if you don't need or want absolute
# time responses.  An example is asking when the currently playing item will
# end.  If you have SKILL_TZ defined, it will also tell you the wall-clock
# time when the item will conclude.
SKILL_TZ =

LAMBDA_ENV_VARS = KODI_SCHEME,KODI_ADDRESS,KODI_PORT,KODI_SUBPATH,KODI_USERNAME,KODI_PASSWORD,SKILL_APPID,SKILL_TZ

AWS_DEFAULT_REGION = eu-west-1
LAMBDA_TIMEOUT = 60
LAMBDA_MEMORY_SIZE = 128
LAMBDA_HANDLER = wsgi.lambda_handler

AWS_ACCESS_KEY_ID = ABCDEFGHIJKLMNOPQRST
AWS_SECRET_ACCESS_KEY = 1234567890abcdefghijklmnopqrstuvwxyz1234
LAMBDA_ROLE = arn:aws:iam::123456789012:role/lambda

STEP 4: Uploading Lambda code to Amazon server:
25/. sudo apt-get install python-pip
26/. pip install lambda-deploy
27/. python deploy-to-lambda.py (note this raises an exception Sad - see note 1. I noticed that a warning was issued stating a newer version (9.0.1) was available (w.r.t. 8.1.2, hence why the next instruction is to upgrade pip)
28/. pip install --upgrade pip
29/. python deploy-to-lambda.py (note this appears to function correctly Big Grin; the last line echoed by python is 'Successfully deployed kodi-alexa version 1')

STEP 5: Setting up lambda function 'kodi-alexa':
30/. Logon to https://eu-west-1.console.aws.amazon.com/lambda/home making sure 'Ireland' is selected in the top right hand corner. The newly created 'kodi-alexa' function is present in the function list.
31/. Select 'kodi-alexa' and select the 'Triggers' tab.
32/. 'Add trigger', click within the grey dashed square and select 'Alexa Skills Kit'.
33/. Click on the 'Submit' button.
34/. Make a note of the ARN for this function which is in the top right hand corner. For the purposes of this explanation, it is:
Quote:arn:aws:lambda:eu-west-1:123456789012:function:kodi-alexa

STEP 6: Setting up the Alexa skill:
35/. Logon to https://developer.amazon.com/edw/home.html
36/. Click on Alexa Skills Kit -> Get Started.
37/. Click on 'Add a new skill'
38/. Choose the following options for the new skill:
Quote:Skill type : 'Custom Interaction model'
Language : 'English (U.K.)
Name : Kodi
Invocation Name : kodi
Audio player directives? : No
39/. Click on 'Save' and then 'Next'
40/. I noticed the only way I could create custom slots was to do the following:
a/. Click on 'DASHBOARD', 'ALEXA', and then 'Alexa Skills Kit -> Get Started'
b/. Click on 'Edit' for the newly created Kodi skill. The following blue text will then appears 'Please wait while details for this skill are retrieved'
41/. Go to the following website to auto generate the data necessary for the 9 custom slots; https://slot-generator.herokuapp.com/ and use the following details before clicking on the 'SUBMIT' button:
Quote:Kodi Address : http://blah.ddns.net
Port : 8041
Kodi Username : kodi
Kodi Password : password
42/. For my particular setup, I have a large number of items in the SHOWS, MOVIES, MOVIEGENRES, MUSICARTISTS, MUSICALBUMS, MUSICSONGS and ADDONS slots (and nothing for MUSICPLAYLISTS and VIDEOPLAYLISTS). Just in case there is an issue with a large number of items in each slot, I have limited each one to up to 4 items. For MUSICPLAYLISTS and VIDEOPLAYLISTS, there is one item called 'Empty'.
43/. Click on 'Add Slot Type', enter type is 'SHOWS' and Enter the following values before clicking on the 'Save' button:
Quote:Dexter
Downton Abbey
Grey's Anatomy
44/. Click on 'Add Slot Type', enter type is 'MOVIES' and enter the following values before clicking on the 'Save' button:
Quote:Mission to Mars
Aladdin
Goldfinger
Total Recall
44/. Click on 'Add Slot Type', enter type is 'MOVIEGENRES' and enter the following values before clicking on the 'Save' button:
Quote:Music
Animation
Drama
Science Fiction
45/. Click on 'Add Slot Type', enter type is 'MUSICARTISTS' and enter the following values before clicking on the 'Save' button:
Quote:S Club 7
Madonna
James Brown
Oasis
46/. Click on 'Add Slot Type', enter type is 'MUSICALBUMS' and enter the following values before clicking on the 'Save' button:
Quote:Hey Jude
#1's
The Collection
Evil Empire
47/. Click on 'Add Slot Type', enter type is 'MUSICSONGS' and enter the following values before clicking on the 'Save' button:
Quote:Nakasaki I Need a Lover Tonight
Nothing Compares 2 U
Crazy
Live To Win
48/. Click on 'Add Slot Type', enter type is 'MUSICPLAYLISTS' and enter the following values before clicking on the 'Save' button:
Quote:Empty
49/. Click on 'Add Slot Type', enter type is 'VIDEOPLAYLISTS' and enter the following values before clicking on the 'Save' button:
Quote:Empty
50/. Click on 'Add Slot Type', enter type is 'ADDONS' and enter the following values before clicking on the 'Save' button:
Quote:OpenELEC Configuration
YouTube
iPlayer WWW
51/. Copy and paste the contents of 'alexa.intents' to the intent schema (note the blank line at the end of the original contents is removed).
52/. Copy and paste the contents of 'alexa.utterances' to Sample Utterances.
53/. Click on 'Save' and then 'Next'
54/. Select 'AWS Lambda ARN (Amazon Resource Name)'.
55/. Select 'Europe' and then copy and paste the ARN function URL for kodi-alexa:
Quote:arn:aws:lambda:eu-west-1:123456789012:function:kodi-alexa
56/. Select 'No' to account linking, then 'Save' and then 'Next'
57/. Next test by typing in 'play a random movie' - this should work Blush. click 'Next'.
58/. Define the following (though I doubt the specifics are that important):
Quote:Category : Smart Home
Testing Instructions : Kodi Alexa
Countries & Regions : 'In all countries and regions where Amazon distributes skills'
Short Skill Description : Kodi Alexa
Full Skill Description : Kodi Alexa
Examples Phrases : [INSERT 3 EXAMPLE PHRASES]
Small icon : Browse and choose any JPEG of size 108x108 (if required use Paintshop Pro to create one)
Large icon : Browse and choose any JPEG of size 512x512 (if required use Paintshop Pro to create one)
59/. Click 'Save' and then 'Next'
60/. Select 'No' to the 3 privary questions and assuming you are happy with the terms, agree to Export Compliance.
61/. Finally click on 'Save'.

STEP 7: Final Test:
62/. On your Alexa Dot/Echo, say 'Alexa, ask Kodi to play a random movie'. A random movie should hopefully start.

STEP 8: Adding more items to the custom slots:
63/. Go back to Interaction Model and add all items (i.e. from step 41). I had to remove all quotation marks from the items, for which I used Notepad++.

Note 1 (output when issuing 'python deplot-to-lambda.py before updating pip) (see sub-step 27):
Code:
2017-02-19 18:15:02:INFO:botocore.credentials: Found credentials in environment variables.
2017-02-19 18:15:02:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-02-19 18:15:02:WARNING:lambda_deploy: A .env file exists in your Lambda directory - be careful that it does not contain any secrets you don't want uploaded to AWS!
2017-02-19 18:15:02:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/share/python-wheels/setuptools-26.1.1-py2.py3-none-any.whl/setuptools/command/install.py", line 38, in finalize_options
    orig.install.finalize_options(self)
  File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "/home/r/.local/bin/lambda-deploy", line 11, in <module>
    sys.exit(main())
  File "/home/r/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 376, in main
    method()
  File "/home/r/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 172, in deploy
    zfh = self.package()
  File "/home/r/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 156, in package
    self.lambda_name
lambda_deploy.lambda_deploy.DependencyInstallationError: Failed to install dependencies of kodi-alexa
Collecting requests (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 1))
  Using cached requests-2.13.0-py2.py3-none-any.whl
Collecting gunicorn (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 2))
  Downloading gunicorn-19.6.0-py2.py3-none-any.whl (114kB)
Collecting yaep (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 3))
  Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 4))
  Downloading pycountry-17.1.8.tar.gz (9.0MB)
Collecting pytz (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 5))
  Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
Collecting fuzzywuzzy (from -r /home/r/kodi-alexa-master/kodi-alexa/requirements.txt (line 6))
  Downloading fuzzywuzzy-0.14.0-py2.py3-none-any.whl
Building wheels for collected packages: pycountry
  Running setup.py bdist_wheel for pycountry: started
  Running setup.py bdist_wheel for pycountry: finished with status 'done'
  Stored in directory: /home/r/.cache/pip/wheels/08/84/6d/250dc9033fcd7640bf49a564a1d2d77fb0f21501b5042fa8be
Successfully built pycountry
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy