• 1
  • 163
  • 164
  • 165
  • 166
  • 167(current)
Release -  Kanzi: Amazon Alexa skill for Kodi
Another point:  Note that (to my knowledge), you need to log into your Alexa Developer account to develop or edit the Skill itself, and separately to the AWS Developer account to edit the Lambda skill server.  I think that the same Amazon logon will allow you to log into both accounts, but you still need to log into each separately, and you may need to create the two accounts separately (I don't recall about this.  I may have created the accounts separately but used the same logon for both.)
(2018-12-28, 16:46)RodinMe Wrote: In following the lexigr.am instructions, you either chose the AWS Lambda or the Heroku choice.  In either case, Lexigram required you to log into your AWS account.  If you chose the AWS Lambda route, you were required to create a zipped file and then upload it to Lambda.  When that step was finished, you were (are) logged into the AWS Mnagement Console, in the "Lambda" service, with a Lambda function having been created (with the name "kanzi", I think.)  In the upper right hand corner of the browser window is an ARN, like:

ARN - arn:aws:lambda:us-east-1:xxxxxxxxxxx:function:name,

with the xxxxxxx uniquely assigned by Lambda and the "name" being the function name.  That's the arn you need (leaving off the "ARN - ").  You need it because your Alexa skill needs to call this function,  residing on an AWS server in the case of Lambda.  

If you went the Heroku route, you will need a string starting with https://...., which is assigned by Heroku and displayed with the Heroku function that was created by Lexigram.

The reason for all of this is that Kodi-Alexa requires 2 separate functions - the Alexa skill, which must reside on the Amazon Alexa server, and the server function which can reside on Alexa Lambda, Heroku, or your own server.  In any case, the Alexa skill needs to find the server back end.  Thus the arn: or https:// address.
 Hi RodinMe, 

Thank you for the explanation. I kind of remember some of those steps. However, I looked over the https://lexigr.am/ site again - but there is no mention on how to setup the AWS Lambda in sight. I may be blind (no problem here) but I cannot find anything related to it on this site.
I cannot seem to get Alexa to see all of my media. I've added the global search addon which means she can find it but it doesn't play automatically. Is there a step i'm missing?
Just say something like, Alexa, ask kodi to watch _movie_
For some things it will play automatically for others it would give an error until I added the global search addon. Before the addon was enabled it would go to recently added music by default for everything it could not find.
What are you saying to the Echo, exactly?
I can say "Alexa ask Kodi to watch Bob's Burgers" and it loads the next unwatched show.
If I say "Alexa ask Kodi to watch Seinfeld" it gives an error:
"The target Lambda application returned a failure response"
 Here is the log from Lambda after asking to watch Seinfeld. https://paste.kodi.tv/xalagevini.kodi
Amazon isn't passing anything for that request.

Try, 'alexa, ask kodi to watch the next episode of Seinfeld'
(2018-12-31, 06:07)jingai Wrote: Amazon isn't passing anything for that request.

Try, 'alexa, ask kodi to watch the next episode of Seinfeld'
 Yup that works. Wonder what's up with Alexa and Seinfeld. There are a few other shows that do the same thing.
Would appreciate if you could take a minute or two to review the steps below and see if you can spot where I'm going wrong.  

I'm running Solus Linux on my desktop and installed nvm from the package manager.  After that I followed the directions to install the correct version of node.

[email protected]ThinkPad ~ $ nvm install 8.11.1
Downloading and installing node v8.11.1...
Downloading https://nodejs.org/dist/v8.11.1/node-v8....x64.tar.xz...
############################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Creating default alias: default -> 8.11.1 (-> v8.11.1)
[email protected]ThinkPad ~ $ nvm use 8.11.1
Now using node v8.11.1 (npm v5.6.0)
[email protected]ThinkPad ~ $ npm install -g lexigram-cli
npm WARN deprecated [email protected]: This version is no longer maintained. Please upgrade to the latest version.
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?searc...ion=3.10.1 - Run `npm i [email protected] -g` to upgrade your npm version, and then `npm audit` to get more info.
/home/chbmb/.nvm/versions/node/v8.11.1/bin/lexigram -> /home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/dist/index.js

> [email protected] install /home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

make: Entering directory '/home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/node_modules/dtrace-provider/build'
  TOUCH Release/obj.target/DTraceProviderStub.stamp
make: Leaving directory '/home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/node_modules/dtrace-provider/build'

> [email protected] postinstall /home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/node_modules/spawn-sync
> node postinstall

> [email protected] postinstall /home/chbmb/.nvm/versions/node/v8.11.1/lib/node_modules/lexigram-cli/node_modules/caporal
> (test -f ./node_modules/husky/bin/install.js && node ./node_modules/husky/bin/install.js) || exit 0

+ [email protected]
added 331 packages in 11.83s
[email protected]ThinkPad ~ $ lexigram login --no-browser true
-------------------- Initialize CLI --------------------
? There is no AWS credential setup yet, do you want to continue the initialization? (Default: False) Yes
Warning: Profile: "default" will not be able to deploy lambda functions since no AWS credentials are set up.

Paste the following url to your browser:

? Please enter your Authorization Code:  xxxxxxxxxxxxxxxxxxxx
Tokens fetched and recorded in ask-cli config.

Profile [default] initialized successfully.
[email protected]ThinkPad ~ $ lexigram init-config
[email protected]ThinkPad ~ $ lexigram init-skill kanzi
  Initialize kanzi skill

My instance of Kodi (on LibreELEC) is set to allow remote control via HTTP (I already have a google home mini successfully communicating with it) and all the settings are still on default as it's not open to WAN, and it resides on

My aim is to self host the gunicorn server using the docker container, so installed the container on my server (IP address

docker run -d \
--name='kodi-alexa' \
- TZ="Europe/London" \
-e 'KODI_ADDRESS'='' \
-e 'KODI_PORT'='8080' \
-e 'KODI_USERNAME'='kodi' \
-e 'KODI_PASSWORD'='kodi' \
-p '8000:8000/tcp' \
-v '/mnt/disks/virtualisation/appdata/kodi-alexa/':'/config':'rw,slave' \

All looks good in the logs.

[2019-01-07 20:05:48 +0000] [9] [INFO] Starting gunicorn 19.7.1
[2019-01-07 20:05:48 +0000] [9] [INFO] Listening at: (9)
[2019-01-07 20:05:48 +0000] [9] [INFO] Using worker: sync
[2019-01-07 20:05:48 +0000] [13] [INFO] Booting worker with pid: 13

And I'm exposing it to WAN using an Nginx reverse proxy with LetsEncrypt certs using this location block.

    location /kodi-alexa {
        rewrite           ^/kodi-alexa/(.*)  /$1  break;
        proxy_redirect /kodi-alexa;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Server $host;
        proxy_set_header   X-Forwarded-Host $server_name;

Next I edit the kodi.config file, I've removed the commented lines below for sake of brevity.

language = en

deep_search = yes

playlist_max_items = 100

unwatched_shows_max_results     = 100
unwatched_episodes_max_results  = 100
unwatched_movies_max_results    = 100

loglevel = INFO

logsensitive = yes


skill_id =

slot_items_max = 100

scheme   = http
address  =
port     = 8080
subpath  =
username = kodi
password = kodi

cache_bucket =

s3_cache_aws_access_key_id =
s3_cache_aws_secret_access_key =

owncloud_cache_url =
owncloud_cache_user =
owncloud_cache_password =

read_timeout = 120

read_timeout_async = 0.01

shutdown =

timezone = Europe/London


# living room dot
address = living-room-kodi

# kitchen echo
address = living-room-kodi

# kids room dot
address = kids-room-kodi

# office dot
address = office-kodi

# tap
address = living-room-kodi

Then deploy it to Amazon.

[email protected]ThinkPad ~ $ lexigram deploy kanzi

[1] Kanzi
[2] Kodi

What would you like your invocation name to be? [1, 2, 0]: 1
What's the URL for your skill server? (ex. https://... or arn:...). Press enter to skip. https://server.com/kodi-alexa/
  Check config file
  Validate config file
  Check skill directory
  Remove old repo code
  Download latest source code
  Extract source code
  Extract source code - Part 2
  Update skill data
  Update slot values
  Deploy skill

Log in to alexa.amazon.co.uk and enable the skill


Log in to developer.amazon.com

Endpoint is correct (I've replaced my domain name with server.com Wink


Build looks fine

However the docker logs don't look good

[2019-01-09 00:29:00,994] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/site-packages/flask_ask/core.py", line 728, in _flask_view_func
ask_payload = self._alexa_request(verify=self.ask_verify_requests)
File "/usr/local/lib/python2.7/site-packages/flask_ask/core.py", line 662, in _alexa_request
cert = verifier.load_certificate(cert_url)
File "/usr/local/lib/python2.7/site-packages/flask_ask/verifier.py", line 21, in load_certificate
if not _valid_certificate(cert):
File "/usr/local/lib/python2.7/site-packages/flask_ask/verifier.py", line 63, in _valid_certificate
value = str(extension)
File "/usr/local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 779, in __str__
return self._subjectAltNameString()
File "/usr/local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString
method = _lib.X509V3_EXT_get(self._extension)
AttributeError: 'module' object has no attribute 'X509V3_EXT_get'

And the developer console shows this


But very often I cannot get an output only an overlaid message saying "Skill I/O is available only for speech requests to skills you have created."

I'm at a bit of a loss as to where to go from here and would really appreciate a fresh pair of eyes.
Try using cryptography==2.1.4 instead of the latest. I've run into the same issue but haven't had time to fix it properly. Downgrading cryptography fixes it in the meantime though.
(2019-01-09, 03:47)jingai Wrote: Try using cryptography==2.1.4 instead of the latest. I've run into the same issue but haven't had time to fix it properly. Downgrading cryptography fixes it in the meantime though.
Thanks @jingai  Perfect!  That worked.
For anyone else who runs into this issue.

First open a terminal into the docker container
docker exec -it kodi-alexa bash
Check the cryptography package version installed
pip freeze | grep cryptography
Output confirms version isn't 2.1.4.
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Install the compatible version as @jingai advised above
pip install cryptography==2.1.4 --force-reinstall
Logs should indicate a downgrade of the version
Collecting cryptography==2.1.4
  Downloading https://files.pythonhosted.org/packages/...x86_64.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 576kB/s
Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography==2.1.4)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography==2.1.4)
Installing collected packages: cryptography
  Found existing installation: cryptography 2.2.2
    Uninstalling cryptography-2.2.2:
      Successfully uninstalled cryptography-2.2.2
Successfully installed cryptography-2.1.4
Then exit from the docker container with
And to finish off (it won't work until you do this step)
docker restart kodi-alexa

Note if you pull the image again you will need to repeat this process.
Spoke too soon. Everything works perfectly if I use the developer console using the microphone on my laptop or typing in tests.

When it comes to testing using an actual Alexa device tied to the same Amazon account and with the skill enable in "Your Skills" (Dev) section it just isn't playing ball even with simple things like "Alexa ask Kanzi to pause"

Am I missing a step to deploy this to prod or is my voice just too weird?!

EDIT:  Seems to have been resolved by removing my devices from my account and re-adding them.
  • 1
  • 163
  • 164
  • 165
  • 166
  • 167(current)
Thread Rating:
  • 14 Vote(s) - 4.71 Average

Logout Mark Read Team Forum Stats Members Help
Kanzi: Amazon Alexa skill for Kodi4.7114