Amazon account setup
Before you can add a custom skill to Alexa, Amazon requires that you have a 'developer' account. You can get everything setup here. Just login with your normal Amazon account and it'll walk you through a few steps you have to take.
The recommended way of setting up the skill involves using a command line interface that we have developed. To use this program, a framework called NodeJS is needed for it to run.
One of the the easiest way to get Node is to use nvm.
- For Linux/Mac users: click here.
- For Windows users: click here. After installing on Windows, please reboot your computer.
Once you have that installed, run these commands:
nvm install 8.11.1 nvm use 8.11.1
This will install Node version 8 which will allow us to run the cli.
Installing the cli
After Node is setup, installing the cli couldn't be any easier:
npm install -g lexigram-cli
Now, use the cli to login to Amazon. Make sure you use the name 'default'. If the prompt asks you if you would like to continue even though it can't find AWS credentials, just type
y and hit enter.
If you can't login due to a port conflict issue, try this command instead:
lexigram login --no-browser true
Let's keep going by downloading an empty config file that you'll use later:
And then initialize the skill you want to use:
lexigram init-skill kanzi
lexigram init-skill koko
Before a command from Alexa can be sent to Kodi, you need to enable the following settings found under Settings -> System -> Services -> Web server in Kodi:
- Allow remote control via HTTP
- Allow remote control from applications on this system
- Allow remote control from applications on other systems
Note that wording might change depending on the version of Kodi you have installed. This example is for Kodi 17:
Next, supply a Username and Password that you don't use anywhere else. You can share these credentials with all of your Kodi installations, but you should not use the same credentials you might use elsewhere on the web.
Repeat this for every installation of Kodi you have that you wish to control via the skill. All of this information -- including the port number -- can be the same for every installation of Kodi if you wish. If you are unsure, set up every instance of Kodi the same way to avoid confusion.
Unless you have a very specific reason to do so, there is no reason to change the port number from the default. Your router will control access from the outside world.
Make note of the port, username, and password you are using for later steps.
If you have more than one instance of Kodi you would like to control with this skill, make note of the private IP address for each machine as well. Private IP addresses are typically addresses like 192.168.1.9 or 192.168.0.23
Note regarding MySQL and performance
If you are using MySQL as a database backend for Kodi, please note that there are known issues with the optimizer in MySQL 5.7.6+ that will cause any commands that involve queueing items in bulk to be tremendously slow. There is nothing in the skill we can do to fix this, as it is technically a MySQL bug/limitation; however, you can either stay on MySQL < 5.7.6 or you can easily migrate to another that doesn't have this problem, such as MariaDB.
As far as we are aware, SQLite (the default) and Emby do not share this issue.
Obtaining Your Internet Address
This skill is hosted in the "cloud," unless you opt to host it yourself locally. As such, it will need to know your internet address to contact Kodi.
While you can use your public IP address, with most residential internet providers this address can change over time, which would necessitate setting up the skill again.
To avoid this, before you continue, we suggest you set up what's called a Dynamic Domain Name with a service provider such as Dynu. HowToGeek.com provides a guide for setting this up.
Whether you choose to use your public IP address or obtain a dynamic domain name, make note of it before continuing.
Unless you are hosting the skill locally, it is required that you have the Kodi web server(s) opened up to the internet via port forwarding on your router.
For each Kodi instance, you will need a port forwarding rule on your router. For each private IP address (i.e., the local address of each machine on which Kodi is installed), you need to forward a unique external port to that private IP address on your router.
If you followed our suggestion and set up all of your Kodi instances with the default port, you would forward them all like so:
- Kodi1: external port 8080, internal -> 192.168.1.10:8080
- Kodi2: external port 8081, internal -> 192.168.1.11:8080
- Kodi3: external port 8082, internal -> 192.168.1.12:8080
And so on for each instance of Kodi that you wish to control via the skill. The key here is that the external port number needs to be unique for each instance.
For more information on port forwarding, see this HowToGeek guide.