Follow these steps to easily control your kodi using simple voice commands with your Google Home or Google assistant:
"Hey Google, kodi play [movie name]" --> will search for the given movie name and play it.
"Hey Google, kodi play tv show [tv show name]" --> will search for the given tv show and play the next unwatched episode.
"Hey Google, kodi play [tv show name] season 3 episode 1" --> will search for the given tv show and play season 3 episode 1.
"Hey Google, pause kodi"
"Hey Google, stop kodi"
Disclaimer: Use on your own risk and choose complex username & password in the below steps.
- In Kodi, go to Settings >> Web server
- Set Allow remote contorl via HTTP to On
- Choose a port number (e.g. 8080)
- Choose a username and password (Important!)
- Configure your router to forward the port your selected to your kodi device
- Find your external IP address (i.e. Google 'what's my ip?')
- Go to Glitch.com and sign in with your github user
- Create a new Glitch project and under advance settings choose Import from GitHub
- Enter this project OmerTu/GoogleHomeKodi
- Change Glitch project settings to private (under advance settings)
- Edit the .env file in your Glitch project with the following settings:
KODI_IP="YOUR_EXTERNAL_IP_ADDRESS"
KODI_PORT="YOUR_KODI_PORT"
KODI_USER="YOUR_KODI_USER_NAME"
KODI_PASSWORD="YOUR_KODI_PASSWORD"
AUTH_TOKEN="YOUR_CONNECTION_PASSWORD"
YOUR_CONNECTION_PASSWORD can be anything you want.
- Check your Glitch server address by choosing 'Show Live' on the top left. A new tab with your server will open. Note your server address in the address bar.
-
Go to IFTTT
-
Create a new applet: if This then That
-
For This choose: Google Assistance
- Choose Say a phrase with a text ingredient
- In What do you want to say? enter something like:
Kodi play $
- In What do you want the Assistant to say in response? enter something like:
ok playing $ movie
-
For That choose: Maker Webhooks
- Choose Make a web request
- In URL enter:
YOUR_GLITCH_SERVER_ADDRESS/playmovie?q= {{TextField}}
For example, if your glitch server address is 'green-icecream.glitch.me', your should enter:
https://green-icecream.glitch.me/playmovie?q= {{TextField}}
- Method: Get
- Content Type: application/json
- Body:
{"token":"YOUR_CONNECTION_PASSWORD"}
Now every time you say "Hey Google, Kodi play movie bla bla", it should play bla bla on your kodi.
Note: If your external IP changes, this will stop working (consider getting a static IP address)
For Tv show support - Next unwatched episode, follow all the steps in C, except these changes:
- Choose a different phrase (e.g. "Kodi play an episode of $")
- Use this URL:
YOUR_GLITCH_SERVER_ADDRESS/playtvshow?q= {{TextField}}
For Tv show support - Specific episode, follow all the steps in C, except these changes:
- Choose "Say a phrase with both a number and a text ingredient" in step 3
- Choose a different phrase (e.g. "Kodi play $ episode #").
For this to work, when you talk to your GoogleHome, the $ part must be in the format of "[TV_SHOW_NAME] season [SEASON_NUMBER]". Meaning the word "Season" has to be said, the tv show name must be said before it and the season number must be said after it (i.e. "okay google kodi play bla season 4 episode 1")
- Use this URL:
YOUR_GLITCH_SERVER_ADDRESS/playepisode?q= {{TextField}}&e= {{NumberField}}
To pause or resume kodi follow the instructions in C, except these changes:
- Choose "Say a simple phrase" in step 3
- Use this URL:
YOUR_GLITCH_SERVER_ADDRESS/playpause
To Stop kodi, follow the same instructions as pause but use this URL:
YOUR_GLITCH_SERVER_ADDRESS/stop
- Go to Glitch.com and sign in with your github user
- Select your Glitch project and under advance settings choose Import from GitHub
- Enter this project OmerTu/GoogleHomeKodi
If your can't preform a simple action like pausing a video, try to narrow down to problem:
- While a video is being played in Kodi, try pausing it by entering this in your browser:
http://YOUR_INTERNAL_KODI_IP:PORT/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.playpause","params":{"playerid":1}}
If you get prompt to enter username and password choose the ones you set in Kodi (step A above). If that doesn't work, you probably have a problem with your kodi setup.
- If that works, try pausing a video using your external IP:
http://YOUR_EXTERNAL_IP:PORT/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Player.playpause","params":{"playerid":1}}
If that doesn't work you probably have a problem with your router configuration.
- If it does work, there might be something wrong in your glich or IFTTT settings.
I used some code from these 2 projects: https://github.com/MarvinSchenkel/HomeyKodi https://github.com/Jephuff/kodi-rpc
And this wonderful website makes setting this up super easy - Glitch (https://glitch.com/about)
I hope you find this helpful! If you'd like, you can give me a cup of coffee :)
