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-20

(2017-02-19, 23:06)Gregg The Bakers Wrote: 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

As I was getting nowhere with keeping heroku awake I decided to try this guide and I used Unbuntu via Parallels Desktop. I got much further than I did with my mac. I'm now stuck, when I type:
python deploy-to-lambda.py

I get:

Code:
mc@ubuntu:~/kodi-alexa-master$ python deploy-to-lambda.py
2017-02-20 07:25:56:INFO:botocore.credentials: Found credentials in environment variables.
2017-02-20 07:25:56:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-02-20 07:25:56: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-20 07:25:56:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
Traceback (most recent call last):
  File "/home/mc/.local/bin/lambda-deploy", line 11, in <module>
    sys.exit(main())
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 376, in main
    method()
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
    Publish=True
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170220T152839Z is now earlier than 20170220T153941Z (20170220T154441Z - 5 min.)
Collecting requests (from -r /home/mc/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/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 2))
  Using cached gunicorn-19.6.0-py2.py3-none-any.whl
Collecting yaep (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 3))
  Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 4))
Collecting pytz (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 5))
  Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting fuzzywuzzy (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 6))
  Using cached fuzzywuzzy-0.14.0-py2.py3-none-any.whl
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Successfully installed fuzzywuzzy-0.14.0 gunicorn-19.6.0 pycountry-17.1.8 pytz-2016.10 requests-2.13.0 yaep-0.0.6
Starting new HTTPS connection (1): lambda.eu-west-1.amazonaws.com
Adding new kodi-alexa lambda
Starting new HTTPS connection (2): lambda.eu-west-1.amazonaws.com
Starting new HTTPS connection (3): lambda.eu-west-1.amazonaws.com

The function is there. Is it something to do with my .env file?


RE: Amazon Echo skill for Kodi - iansy - 2017-02-20

Hi Guys. I have hit a wall trying to upload the code to AWS to get the integration with amazon alexa and kodi. I get a" you must specify a region" error after the C:\Python27\Scripts\lambda-deploy.exe deploy command. I have specified eu-west-1 which is not commented out and is supposed to work in the .env file. I also tried just leaving the default us-east-1 with the same error. Any help would be appreciated.


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

Hi T800,

In order to answer your question, which version of Python (and pip) are you using? Also which version of Ubuntu have you installed in parallels desktop?


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

Other things to check T800, the error message you are getting eludes to a problem with your clock in Ubuntu. Is it accurately set?

Also, the warning message you get regarding the .env file appears to be common and not something to be concerned about. However, if you post the contents of your .env file (taking care to remove any personal information) we should be able to help you further.


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

iansy,

Like you, I tried uploading the function to AWS via Windows but got similar errors. Although my approach is long winded, it does work and will probably take you less time! Installing Virtual Box and then Ubuntu is very simple and will not affect your Windows install. Just in case you choose this approach, I have included a step-by-step guide for the initial install of VirtualBox / Ubuntu:

Step A: Download everything you need:
1/. Download the latest version of VirtualBox (as of 20th February, 2017, this was the link): http://download.virtualbox.org/virtualbox/5.1.14/VirtualBox-5.1.14-112924-Win.exe. I am assuming you have a 64 bit version of Windows.
2/. Download Ubuntu 16.10. Later versions may work, but this version (and all the associated packages) I have tested. (ubuntu-16.10-desktop-amd64.iso). Link is: http://releases.ubuntu.com/16.10/ubuntu-16.10-desktop-amd64.iso

Step B: Install VirtualBox:
3/. Double click on the executable you have just downloaded. Click OKAY and AGREE whenever you are prompted.
4/. Once VirtualBox has started, click on 'New' and use the following options:
Quote:Name: Ubuntu 16.10
Type: Linux
Version Ubuntu (64 bit)
5/. Set memory size to at least 1024MB
6/. 'Create a virtual hard disk now'
7/. Select 'VDI (Virtual Disk Image)'
8/. Select 'Dynamically allocated'
9/. Set hard disk size to at least 100GB. Note the virtual disk will not be the size initially in Windows and will expand in size as the space is needed.
10/. Select Ubuntu 16.10 item and click on the 'Settings' button
11/. Go to the 'Storage' tab and click on the 'Empty' item under 'Controller: IDE' in the storage tree. To the right, under 'Attributes, click on the small CD icon with a downward arrow head.
12/. Select 'Choose Virtual optical disk file' and select the Ubuntu 16.10 iso-file you have just downloaded. Then click on OK to close the Settings window.
13/. Making sure Ubuntu 16.10 item is still selected, click on the 'Start' button.

Step C: Install Ubuntu
14/. Wait for the ISO file to boot and then click on 'Install Ubuntu'.
15/. Click on Continue (no need to download updates or third party addons)
16/. 'Erase disk and install Ubuntu (note this won't erase your Windows disk(!) only the virtual hard drive you have just created), then click on 'Install Now'
17/. Click on 'Continue' when prompted whether to write the changes to disk.
18/. Choose your time zone (for me this would be London) and click on 'Continue'.
19/. Choose your keyboard layout (for me this would be English (UK) - English (UK)' and click on 'Continue'
20/. Choose your name, computer's name, a username, a password and confirm your password, then click on 'Continue'.
21/. Wait for Ubuntu to finish installing which should take approx 10 minutes depending on your machine.
22/. Once complete, click on 'Restart Now' and then press the 'ENTER' key (VirtualBox should have 'ejected' the ISO for you).

Step D: Use Ubuntu:
23/. Log on using the password you chose.
24/. Open this thread from within Ubuntu.
24/. Right click on the Ubuntu desktop and choose 'Open terminal'.
25/. Follow the original instructions as given in post #1097 ..


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

(2017-02-20, 21:20)Gregg The Bakers Wrote: Hi T800,

In order to answer your question, which version of Python (and pip) are you using? Also which version of Ubuntu have you installed in parallels desktop?

I set the clock this morning.

I'm running Unbuntu 16.4

My python is
Code:
Python 2.7.12

and my pip is
Code:
pip 9.0.1 from /home/mc/.local/lib/python2.7/site-packages (python 2.7)

I noticed on the LAMBDA_ROLE I had missed the "arn" which is now in there.

It says Adding new kodi-alexa lambda at the end but nothing appears in the lambda function but I guess it should say 'Successfully deployed' etc.

I googled the error and people were saying certain characters don't work in the secret key so I refreshed it until I got one with just number and letters
Here is the latest output:
Code:
mc@ubuntu:~/kodi-alexa-master$ python deploy-to-lambda.py
2017-02-21 10:00:41:INFO:botocore.credentials: Found credentials in environment variables.
2017-02-21 10:00:41:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-02-21 10:00:41: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-21 10:00:41:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
Traceback (most recent call last):
  File "/home/mc/.local/bin/lambda-deploy", line 11, in <module>
    sys.exit(main())
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 376, in main
    method()
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
    Publish=True
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170221T100053Z is now earlier than 20170221T101110Z (20170221T101610Z - 5 min.)
Collecting requests (from -r /home/mc/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/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 2))
  Using cached gunicorn-19.6.0-py2.py3-none-any.whl
Collecting yaep (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 3))
  Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 4))
Collecting pytz (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 5))
  Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting fuzzywuzzy (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 6))
  Using cached fuzzywuzzy-0.15.0-py2.py3-none-any.whl
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Successfully installed fuzzywuzzy-0.15.0 gunicorn-19.6.0 pycountry-17.1.8 pytz-2016.10 requests-2.13.0 yaep-0.0.6
Starting new HTTPS connection (1): lambda.eu-west-1.amazonaws.com
Adding new kodi-alexa lambda

My.env file, I noitced was missing the "arn at the beginning of the lambda role but tried it again and still nothing appears in my lambda functions other than my google one:

Code:
# The Kodi webserver only supports HTTP.
# Uncomment KODI_SCHEME to tell the skill to use https between AWS and your loc$
# (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$
# You can do this with KODI_SUBPATH (don't use slashes before or after)
#
# KODI_SUBPATH =

KODI_ADDRESS = myaddress
KODI_PORT = 8082
KODI_USERNAME = kodilr
KODI_PASSWORD = 01234

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,SKIL​L_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 = AKIAI6W7TZ0123456789
AWS_SECRET_ACCESS_KEY = 4zx1wb5XMm4Dfs4bgjLf6JrZ7mLXFz0123456789
LAMBDA_ROLE = arn:aws:iam::970123456789:role/lambda



RE: Amazon Echo skill for Kodi - HartzF34R - 2017-02-21

Hi T800,

maybe a dumb question, but have you selected the right region in AWS (on top of the page, right next to your name it should say "Ireland" and not "N. Virginia")? Because from your logs provided everything looks OK.


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

(2017-02-21, 15:05)HartzF34R Wrote: Hi T800,

maybe a dumb question, but have you selected the right region in AWS (on top of the page, right next to your name it should say "Ireland" and not "N. Virginia")? Because from your logs provided everything looks OK.

Yes it's set to Ireland


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

Tried it through Virtualbox on my iMac using Unbuntu 16.10, same output:
Code:
mc@mc-VirtualBox:~/kodi-alexa-master$ python deploy-to-lambda.py
2017-02-21 14:53:56:INFO:botocore.credentials: Found credentials in environment variables.
2017-02-21 14:53:57:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-02-21 14:53:57: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-21 14:53:57:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
Traceback (most recent call last):
  File "/home/mc/.local/bin/lambda-deploy", line 11, in <module>
    sys.exit(main())
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 376, in main
    method()
  File "/home/mc/.local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
    Publish=True
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/mc/.local/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170221T145420Z is now earlier than 20170221T150205Z (20170221T150705Z - 5 min.)
Collecting requests (from -r /home/mc/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/mc/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/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 3))
  Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 4))
  Downloading pycountry-17.1.8.tar.gz (9.0MB)
Collecting pytz (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 5))
  Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
Collecting fuzzywuzzy (from -r /home/mc/kodi-alexa-master/kodi-alexa/requirements.txt (line 6))
  Downloading fuzzywuzzy-0.15.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/mc/.cache/pip/wheels/08/84/6d/250dc9033fcd7640bf49a564a1d2d77fb0f21501b5042fa8be
Successfully built pycountry
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Successfully installed fuzzywuzzy-0.15.0 gunicorn-19.6.0 pycountry-17.1.8 pytz-2016.10 requests-2.13.0 yaep-0.0.6
Starting new HTTPS connection (1): lambda.eu-west-1.amazonaws.com
Adding new kodi-alexa lambda



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

(2017-02-21, 17:14)T800 Wrote: botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170221T145420Z is now earlier than 20170221T150205Z (20170221T150705Z - 5 min.)

Every time we've seen this it was due to an incorrectly set clock. Set your clock via NTP.


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

(2017-02-21, 17:17)jingai Wrote:
(2017-02-21, 17:14)T800 Wrote: botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170221T145420Z is now earlier than 20170221T150205Z (20170221T150705Z - 5 min.)

Every time we've seen this it was due to an incorrectly set clock. Set your clock via NTP.

How do I go about doing that in Unbuntu 16.10 via Virtualbox on my iMac?


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

@T800, See the documentation.


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

As I was doing this on my iMac at work today, I set up virtualbox and unbuntu on my laptop at home when I got in and it worked perfectly without doing anything about ntp. The internet at work is horrendously slow and very fast at home, could that be what it needed, a fast upload speed?


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

All working well without heroku, thanks for all the help!


RE: Amazon Echo skill for Kodi - thismustbeok - 2017-02-21

Hi All,
this is my first post and i have read countless posts on here before posting my question. I am really stuck here and any help would be very welcome.

I have followed all the steps using Lambda and aws etc etc , i have opened a port as instructed and i have also created the app (kodi) as i can see it in my "skills". the issue i have is when i say my trigger word (alexa ask Living Room) alexa replies with "you can ask me to play movies, tv shows or control media playback etc, etc. but when i say alexa "ask living room to open kodi" the blue light comes on and flashes on and off for a few minutes before answering me with "there was a problem communicating with the required skill"

PLEASE HELP ME.... i feel i am almost there!!