•   
  • 1
  • 164
  • 165
  • 166
  • 167(current)
  • 168
  •   
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.)
Reply
(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.
Reply
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?
Reply
Just say something like, Alexa, ask kodi to watch _movie_
Reply
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.
Reply
What are you saying to the Echo, exactly?
Reply
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. xalagevini.kodi (paste)
Reply
Amazon isn't passing anything for that request.

Try, 'alexa, ask kodi to watch the next episode of Seinfeld'
Reply
(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.
Reply
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:
         https://www.amazon.com/ap/oa?redirect_ur...xxxxxxxxxx

? Please enter your Authorization Code:  xxxxxxxxxxxxxxxxxxxx
Tokens fetched and recorded in ask-cli config.
Vendor ID set as XXXXXXXXXXXXXX

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 192.168.0.30

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

docker run -d \
--name='kodi-alexa' \
- TZ="Europe/London" \
-e 'KODI_ADDRESS'='192.168.0.30' \
-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' \
'mboeru/kodi-alexa'

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: https://0.0.0.0:8000 (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_pass         https://192.168.0.1:8000;
        proxy_redirect     https://192.168.0.1:8000 /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


[alexa]

skill_id =

slot_items_max = 100

[DEFAULT]
scheme   = http
address  = 192.168.0.30
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

mongodb_uri=
use_proxy=
alt_proxy=
accept_music_warning=

# living room dot
[amzn1.ask.device.XXX]
address = living-room-kodi

# kitchen echo
[amzn1.ask.device.XXX]
address = living-room-kodi

# kids room dot
[amzn1.ask.device.XXX]
address = kids-room-kodi

# office dot
[amzn1.ask.device.XXX]
address = office-kodi

# tap
[amzn1.ask.device.XXX]
address = living-room-kodi

Then deploy it to Amazon.

[email protected]ThinkPad ~ $ lexigram deploy kanzi

[1] Kanzi
[2] Kodi
[0] CANCEL

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

Image

Log in to developer.amazon.com

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

Image

Build looks fine

Image
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

Image

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.
Reply
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.
Reply
(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.
cryptography==2.2.2
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
exit
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.
Reply
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.
Reply
hello forum
i m running in problems 
try to deploy kanzi
get error 
C:\kodi-alexa>lexigram deploy kanzi

[1] Kanzi
[2] Kodi
[0] CANCEL

What would you like your invocation name to be? [1, 2, 0]: 1
 V Check config file
 V Validate config file
 V Check skill directory
 V Remove old repo code
 V Download latest source code
 V Extract source code
 V Extract source code - Part 2
 V Update skill data
 × Update slot values
   → Kodi server configuration settings are wrong. Please double-check kodi.con.

   Deploy skill
the kodi.config looks like this
#
# Global configuration
#
[global]
# Currently supported languages: en, de, fr
language = de

# By default, if you ask to play media without specifying the type, the skill
# will search through the entire library to find a match.
#
# For example, if you ask, "Alexa, ask Kodi to play ninety nine red balloons,"
# the skill will search library items in the following order to find the song:
#
#   Movies -> Shows -> Artists -> Songs -> Albums
#
# If your library is really large, this can take some time to complete.  While
# it will eventually execute, Alexa may report that the skill timed out.  If
# this behavior bothers you, you can disable deep searches.
#
# When disabled, Alexa will simply provide help in the response directing you
# to issue a play command that includes the media type of the item.
deep_search = yes

# Limit number of items we add to playlists.
#
# Some requests will cause the skill to create a temporary playlist in Kodi
# before executing your command.  This operation is expensive in Kodi, so we
# provide the option here to limit the number of items added.
#
# The default is 100 to match Kodi's own 'party mode.'  Higher values will
# make these operations slower, but if your setup can handle it, you're free
# to set this to whatever you like.
#
# Set to an empty string for unlimited.
playlist_max_items = 100

# Search result limits for new (unwatched) Movies and Episodes.
#
# By default we ask kodi to return a max of 100 results per JSON request.
# Here you can set this figure to optimize the system for you.
# Results are always retrieved in order of newest episodes and movies first.
#
# Lower figures will produce faster results and limit them to only media that
# you've recently added to the library.
unwatched_shows_max_results     = 100
unwatched_episodes_max_results  = 100
unwatched_movies_max_results    = 100

# Set logging level.  Possible values are:
#
# CRITICAL
# ERROR
# WARNING
# INFO
# DEBUG
loglevel = INFO

# Log sensitive or personally identifying information.
#
# Disabling this prevents the skill from logging the target address for Kodi
# and your device IDs.
#
# It is enabled by default to make it easy for you to identify your Echo
# devices for mapping to specific instances of Kodi.
logsensitive = yes


# Global Alexa skill configuration
#
[alexa]
# Set skill_id to enable verification of requests by Flask-Ask.
skill_id =

# Maximum number of items to generate per slot.
#
# If the skill is failing to save, you may need to reduce this.  Conversely,
# if Alexa is having problems distinguishing your requests (executing the
# wrong Intent, for instance), you may need to increase this.
slot_items_max = 100


#
# Default parameters common to all Alexa devices and the web simulator
#
[DEFAULT]
# The Kodi webserver only supports HTTP, but if you've set up a reverse HTTPS
# proxy you can change this to https.
scheme   = http
address  = alarmxxxx.ddns.net
port     = 8080
# If using a reverse proxy you might need to add an extra bit to the url
# before "jsonrpc" (don't use slashes before or after).
subpath  =
username = kodi
password = mypassword

# Caching of Kodi responses.
#
# Provide an Amazon S3 bucket or a directory name here and provide credentials
# for one of the cache backends below to enable.
cache_bucket =

# Amazon S3 cache backend.
#
# Provide an AWS user key and key ID here to enable.
s3_cache_aws_access_key_id =
s3_cache_aws_secret_access_key =

# ownCloud/nextCloud cache backend.
#
# Provide the base URL for your ownCloud server and a valid user and password
# combination to enable.
owncloud_cache_url =
owncloud_cache_user =
owncloud_cache_password =

# Read timeout -- how long to wait for responses from Kodi before giving up.
#
# Normally there is no need to change this.
read_timeout = 120

# For some commands, we don't care about the response from Kodi, so we send
# them "fire-and-forget."  If you've got a proxy server in the middle, though,
# it's possible the command might not make it to Kodi before the skill exits.
#
# If Alexa is telling you she has completed a command but it sometimes does
# not actually execute on Kodi, you may need to increase this.
read_timeout_async = 0.01

# Set shutdown to 'quit' if you'd like "Alexa, tell Kodi to shut down"
# to quit Kodi instead of shutting down the system.
shutdown =

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

# Setup MongoDB to handle playing music from Kodi to your Alexa device
# Must accept agreement saying I'm not liable for stolen information
# since your username and password for Kodi will be stored in plaintext
# in a database and will be transferred over the internet to a HTTPS
# proxy server for you to have this functionality.
#
# mongodb_uri will look like: `mongodb://user:[email protected]:port/database`
# If you're using alternative proxy from Heroku, alt_proxty looks like:
# `https://my-kodi-proxy.herokuapp.com/proxy?file=`
mongodb_uri=
use_proxy=
alt_proxy=
accept_music_warning=


# Override default values by specifying them below for individual devices.
#
# The usual reason to do this is to associate a given Echo device with a
# particular instance of Kodi in your house, but you can override any of
# the other configuration variables from the DEFAULT section here too.
#
# Device IDs can be found in the skill server / lambda log.

# living room dot
[amzn1.ask.device.XXX]
address = living-room-kodi

# kitchen echo
[amzn1.ask.device.XXX]
address = living-room-kodi

# kids room dot
[amzn1.ask.device.XXX]
address = kids-room-kodi

# office dot
[amzn1.ask.device.XXX]
address = office-kodi

# tap
[amzn1.ask.device.XXX]
address = living-room-kodi

how can i find the error or mistake ?

thanks for help

ok url error caused when password includes "special charakters"
deploy hangs
x try and error but
deploy on Win10/32 bit nvm vers 1.1.5 32 bit version will do it for me
Reply
Who can help setup koko ?
i dont understand mongoDb konfiguration and missing a step by step guide
anyone knows about this ?



das ganze in deutsch wär auch nicht schlecht,brech mir hier noch die zunge ab ;-)
Reply
  •   
  • 1
  • 164
  • 165
  • 166
  • 167(current)
  • 168
  •   
 
Thread Rating:
  • 15 Vote(s) - 4.6 Average



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