control your kodi using simple voice commands with your Google Home or Google assistant
3.2K
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 resume [movie name]" --> will search for given movie name and pick up playback from where you left it.
"Hey Google, kodi play a random movie" --> will play a random movie.
"Hey Google, kodi play a random horror movie" --> will play a random movie of the genre "Horror".
"Hey Google, kodi play a random movie of the year 2010" --> will play a random movie of the year 2010.
"Hey Google, kodi play a random horror movie of the year 2010" --> will play a random movie of the genre "Horror" and of the year 2010.
Play the next unwatched episode: "Hey Google, kodi play tv show [tv show name]" --> will search for the given tv show and play the next unwatched episode.
Play a specific 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.
Play a random episode from a tv show: "Hey Google, kodi shuffle [tv show name]" --> will search for the given tv show and play a random episode.
Play the most recently added episode: "Hey Google, kodi play new episode" --> will play the most recently added episode to the kodi library.
"Hey Google youtube [youtube title]" --> will search a youtube video, and play the first video.
"Hey Google, pause kodi"
"Hey Google, stop kodi"
"Hey Google, mute/unmute kodi"
"Hey Google, set kodi volume to 60"
"Hey Google, switch kodi to BBC channel" or "Hey Google, switch kodi to channel 10"
"Hey Google, switch to kodi" --> will turn on the TV and switch to Kodi's HDMI input
"Hey Google, kodi shutdown"
"Hey Google, kodi scan library" --> Will start a full library scan
Navigate up: "Hey Google, kodi navigate up 3" --> Will navigate up the requested amount
Navigate Down: "Hey Google, kodi navigate down 3" --> Will navigate down the requested amount
Navigate Left: "Hey Google, kodi navigate left 3" --> Will navigate left the requested amount
Navigate Right: "Hey Google, kodi navigate right 3" --> Will navigate right the requested amount
Navigate Back: "Hey Google, kodi go back 3" --> Will navigate back requested amount
Navigate Select: Hey Google, kodi Select" --> Will select the hightlighted item
Navigate Context Menu: "Hey Google, kodi open context menu" --> Will open the context menu for the selected item
Navigate Go Home: "Hey Google, kodi go home" --> Will open the main menu page
"Hey Google, kodi Whats Playing" --> Will show whats playing information
"Hey Google, kodi subtitles on/off/previous/next" --> Will change subtitle settings
"Hey Google, kodi change subtitle to track 3" --> Will change subtitle track to a specific track
"Hey Google, kodi audiostream previous/next" --> Will change audiostream settings
"Hey Google, kodi change audiostream to track 3" --> Will change audiostream settings
"Hey Google, kodi go forward 30 minutes"
"Hey Google, kodi go backward 30 minutes"
"Hey Google, kodi jump to 30 minutes"
"Hey Google, kodi play the song [song name]" --> will search for the given song name and play it.
"Hey Google, kodi play the album [album name]" --> will search for the given album name and play it.
"Hey Google, kodi play songs by the artist [music artist name]" --> will search for the given music artist name and play it.
"Hey Google, kodi playlist previous/next/list item number" --> This will go forward/backward or select an item on the playlist #.
Disclaimer: Use on your own risk and choose complex username & password in the below steps.
KODI_PROTOCOL="http"
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.
As an alternative to (B), it's possible to run a local node.js server in stead of running it on Glitch.com. The benifit of this is that you don't need to expose your kodi Api. Additional using the hodi-hosts.config.js file, you can set up and control multiple kodi installations.
kodi-hosts.config.js.dist file and rename it to kodi-hosts.config.js.node server.js.Here is a systemd init config. To run it as a daemon.
On a debian dist save it as /etc/systemd/system/kodiassistant.service.
Don't forget to run: sudo systemctl enable sudo systemctl enable kodiassistant.service to start the deamon on startup.
[Unit]
Description=Node.js Google Home Kodi Interface
[Service]
ExecStart=/usr/bin/node /opt/GoogleHomeKodi/server.js
# Required on some systems
WorkingDirectory=/opt/GoogleHomeKodi
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs-example
[Install]
WantedBy=multi-user.target
Note: you server should run Node.js 6.10 or above (8 preferred)
Setting up the local node server, will allow you to utilize the kodi-hosts.config.js configuration. This configuration will allow you to address multiple kodi installations (e.g. "Hey Google, kodi play [movie name] in the bedroom")
For this you will need to extend the list. Like in this example:
exports.kodiConfig = [{
id: 'kodi', // For now leave the first set to kodi.
// YOUR_EXTERNAL_PROTOCOL (http or https)
kodiProtocol: 'http',
// YOUR_KODI_IP_ADDRESS
kodiIp: '192.168.178.10',
// YOUR_KODI_PORT
kodiPort: '8080',
// YOUR_KODI_USER_NAME
kodiUser: 'kodi',
// YOUR_KODI_PASSWORD
kodiPassword: 'myKodiPass'
},
// You can use this to specify additonal kodi installation, that you'd like to control.
// For example alternate kodi destination 1:
{
id: 'bedroom',
// YOUR_EXTERNAL_PROTOCOL (http or https)
kodiProtocol: 'http',
// YOUR_KODI_IP_ADDRESS
kodiIp: '192.168.1.11',
// YOUR_KODI_PORT
kodiPort: '8080',
// YOUR_KODI_USER_NAME
kodiUser: 'kodi',
// YOUR_KODI_PASSWORD
kodiPassword: 'myKodiPass'
},
// You can use this to specify additonal kodi installation, that you'd like to control.
// For example alternate kodi destination 2:
{
id: 'kitchen',
// YOUR_EXTERNAL_PROTOCOL (http or https)
kodiProtocol: 'http',
// YOUR_KODI_IP_ADDRESS
kodiIp: '192.168.1.12',
// YOUR_KODI_PORT
kodiPort: '8080',
// YOUR_KODI_USER_NAME
kodiUser: 'kodi',
// YOUR_KODI_PASSWORD
kodiPassword: 'myKodiPass'
}
];
The id will match your kodi instance with a spoken keyword.
For every command / kodi destination you will need to add a new IFTTT applet.
You'll only real change here, is the body. As up until now you have been using a body like: {"token":"*YOUR_CONNECTION_PASSWORD*"}.
Now you will need to add the kodiid attribute to it, matching the id of your configuration.
Example scan library
If you normally would use a sentence like: "Hey Google, kodi scan library" --> Will start a full library scan.
For running this command on your second kodi instance, you could copy the applet, and change it to:
"Hey Google, kodi scan library in the bedroom".
In this new applet, you will need to make sure it will recognize this new sentence, and add the attribute kodiid to the body.
For example: {"token":"*YOUR_CONNECTION_PASSWORD*", "kodiid":"bedroom"}
The following steps were done on LibreELEC running on a Raspberry Pi I B, but should be applicable to every OS/Architecture except the first.
docker pull keydon/googlehomekodidocker run -d \
--restart always \
-p 0.0.0.0:8099:8099 \
--name googlehomekodi \
-e KODI_PROTOCOL="http" \
-e KODI_IP="libreelec" \
-e KODI_PORT="8080" \
-e PORT="8099" \
-e KODI_USER="keydon" \
-e KODI_PASSWORD="donkeykeydon" \
-e AUTH_TOKEN="keydondonkey" \
keydon/googlehomekodi
Go to IFTTT
Create a new applet: if This then That
For This choose: Google Assistance
Kodi play $
ok playing $ movie
For That choose: Maker Webhooks
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}}
{"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:
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")
YOUR_GLITCH_SERVER_ADDRESS/playepisode?q= {{TextField}}&e= {{NumberField}}
To pause or resume kodi follow the instructions in C, except these changes:
YOUR_GLITCH_SERVER_ADDRESS/playpause
To Stop kodi, follow the same instructions as pause but use this URL:
YOUR_GLITCH_SERVER_ADDRESS/stop
To Mute kodi, follow the same instructions as pause but use this URL:
YOUR_GLITCH_SERVER_ADDRESS/mute
To Set Volume on kodi use "Say a phrase with a number" and the URL:
YOUR_GLITCH_SERVER_ADDRESS/volume?q={{NumberField}}
To Seek forward the play by x seconds use "Say a phrase with a number" and the URL:
YOUR_GLITCH_SERVER_ADDRESS/seekforward?q={{NumberField}}
For PVR TV support - Set channel by name, follow all the steps in C, except these changes:
YOUR_GLITCH_SERVER_ADDRESS/playpvrchannelbyname?q={{TextField}}
For PVR TV support - Set channel by number, use "Say a phrase with a number" and the URL:
YOUR_GLITCH_SERVER_ADDRESS/playpvrchannelbynumber?q={{NumberField}}
| Type of phrase | phrase | url |
|---|---|---|
| Say a phrase with a text ingredient | Kodi play $ | YOUR_GLITCH_SERVER_ADDRESS/playmovie?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi resume $ | YOUR_GLITCH_SERVER_ADDRESS/resumemovie?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi play a random [$] movie [of year #] | YOUR_GLITCH_SERVER_ADDRESS/playrandommovie?genre={{TextField}}&year={{NumberField}} |
| Say a phrase with a text ingredient | Kodi play an episode of $ | YOUR_GLITCH_SERVER_ADDRESS/playtvshow?q={{TextField}} |
| Say a phrase with both a number and a text ingredient | Kodi play $ episode # | YOUR_GLITCH_SERVER_ADDRESS/playepisode?q={{TextField}}&e= {{NumberField}} |
| Say a simple phrase | Kodi play new episode | YOUR_GLITCH_SERVER_ADDRESS/playrecentepisode |
| Say a simple phrase | Kodi pause | YOUR_GLITCH_SERVER_ADDRESS/playpause |
| Say a simple phrase | Kodi stop | YOUR_GLITCH_SERVER_ADDRESS/stop |
| Say a simple phrase | Kodi mute | YOUR_GLITCH_SERVER_ADDRESS/mute |
| Say a phrase with a number | Kodi set volume # | YOUR_GLITCH_SERVER_ADDRESS/volume?q={{NumberField}} |
| Say a phrase with a text ingredient | Kodi switch to $ channel | YOUR_GLITCH_SERVER_ADDRESS/playpvrchannelbyname?q={{TextField}} |
| Say a phrase with a number | Kodi switch to channel number # | YOUR_GLITCH_SERVER_ADDRESS/playpvrchannelbynumber?q={{NumberField}} |
| Say a simple phrase | Kodi shutdown | YOUR_GLITCH_SERVER_ADDRESS/shutdown |
| Say a phrase with a text ingredient | Kodi shuffle $ | YOUR_GLITCH_SERVER_ADDRESS/shuffleepisode?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi youtube play $ | YOUR_GLITCH_SERVER_ADDRESS/playyoutube?q={{TextField}} |
| Say a simple phrase | Kodi scan library | YOUR_GLITCH_SERVER_ADDRESS/scanlibrary |
| Say a phrase with a number | Kodi Navigate up # | YOUR_GLITCH_SERVER_ADDRESS/navup?q={{NumberField}} |
| Say a phrase with a number | Kodi Navigate down # | YOUR_GLITCH_SERVER_ADDRESS/navdown?q={{NumberField}} |
| Say a phrase with a number | Kodi Navigate left # | YOUR_GLITCH_SERVER_ADDRESS/navleft?q={{NumberField}} |
| Say a phrase with a number | Kodi Navigate right # | YOUR_GLITCH_SERVER_ADDRESS/navright?q={{NumberField}} |
| Say a phrase with a number | Kodi Navigate back # | YOUR_GLITCH_SERVER_ADDRESS/navback?q={{NumberField}} |
| Say a simple phrase | Kodi select | YOUR_GLITCH_SERVER_ADDRESS/navselect |
| Say a simple phrase | Kodi show context menu | YOUR_GLITCH_SERVER_ADDRESS/navcontextmenu |
| Say a simple phrase | Kodi go home | YOUR_GLITCH_SERVER_ADDRESS/navhome |
| Say a simple phrase | Kodi whats playing | YOUR_GLITCH_SERVER_ADDRESS/displayinfo |
| Say a phrase with a text ingredient | Kodi subtitles $ | YOUR_GLITCH_SERVER_ADDRESS/setsubtitles?q={{TextField}} |
| Say a phrase with a number | Kodi subtitles direct select # | YOUR_GLITCH_SERVER_ADDRESS/setsubtitlesdirect?q={{NumberField}} |
| Say a phrase with a text ingredient | Kodi audio stream $ | YOUR_GLITCH_SERVER_ADDRESS/setaudio?q={{TextField}} |
| Say a phrase with a number | Kodi audio stream direct select # | YOUR_GLITCH_SERVER_ADDRESS/setaudiodirect?q={{NumberField}} |
| Say a phrase with a number | Kodi seek forward x minutes # | YOUR_GLITCH_SERVER_ADDRESS/seekforwardminutes?q={{NumberField}} |
| Say a phrase with a number | Kodi seek backward x minutes # | YOUR_GLITCH_SERVER_ADDRESS/seekbackwardminutes?q={{NumberField}} |
| Say a phrase with a number | Kodi seek to x minutes # | YOUR_GLITCH_SERVER_ADDRESS/seektominutes?q={{NumberField}} |
| Say a phrase with a text ingredient | Kodi play the song $ | YOUR_GLITCH_SERVER_ADDRESS/playsong?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi play the album $ | YOUR_GLITCH_SERVER_ADDRESS/playalbum?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi play the artist $ | YOUR_GLITCH_SERVER_ADDRESS/playartist?q={{TextField}} |
| Say a phrase with a text ingredient | Kodi playlist $ | YOUR_GLITCH_SERVER_ADDRESS/playercontrol?q={{TextField}} |
To Turn on the TV and switch to Kodi's HDMI input
This requires Kodi 17 (Krypton) and above
This also requires that both your kodi device and TV support CEC commands
You need to install this script.json-cec add-on: Download and move it to your kodi device and then in Kodi choose Settings>Add-ons>Install from zip file > choose the zip your just downloaded.
Finally you can use this in 2 ways:
YOUR_GLITCH_SERVER_ADDRESS/activatetv
ACTIVATE_TV="true"
If your can't preform a simple action like pausing a video, try to narrow down to problem:
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.
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.
Thanks for everyone who contributed to this projects: p0psicles, Keljian and Lunatixz
I also used some code from these 3 projects: MarvinSchenkel/HomeyKodi Jephuff/kodi-rpc joshjowen/script.json-cec
And this wonderful website makes setting this up super easy - Glitch
I hope you find this helpful! If you'd like, you can give me a cup of coffee :)
Content type
Image
Digest
Size
23.5 MB
Last updated
almost 9 years ago
docker pull keydon/googlehomekodi