Kodi smart home integration, free and open source

Follow and control Kodi: what plays, volume, buttons, scenes when a movie starts.
Follow and control Kodi, the free media center (LibreELEC, OSMC, CoreELEC, Kodi on a PC, an Android TV box or an NVIDIA Shield), from Gladys: what plays, its progress, the volume, the playback buttons, and scenes that react when a movie starts, pauses or stops.
Everything stays on your local network: the integration talks to Kodi directly, through its JSON-RPC interface.
Tested against Kodi 20 and 21 running in Docker, not yet on LibreELEC, OSMC, CoreELEC or an Android box: feedback welcome on the Gladys forum.
Requirements
- Gladys Assistant 5.1 or later.
- Kodi 19 or later (tested on 20 and 21), on the same local network as Gladys.
- In Kodi, Settings → Services → Control:
- Allow remote control via HTTP: on. Note the port (8080 by default), the user name
(
kodiby default) and the password, if you set one. - Allow remote control from applications on other systems: on. It opens port 9090, through which Kodi tells Gladys in real time what happens. Without it, the integration still works but reads Kodi every 10 seconds.
- Allow remote control via HTTP: on. Note the port (8080 by default), the user name
(
- To be found automatically: Settings → Services → General → Announce services to other systems on (the default).
- Give the device running Kodi a fixed IP address (a DHCP reservation in your router).
Configuration
- Install the integration from the Gladys store, then open its Configuration tab.
- Click Find Kodi on the network: each Kodi found takes a free slot (three at most). Reload
the page to see their addresses. Or type the address yourself, e.g.
192.168.1.40, or192.168.1.40:8081if the web server of Kodi does not use port 8080. - If Kodi asks for a password, fill in the User name (empty means
kodi) and the Password of the slot, then save. - Test the connection: one line per Kodi, with its name, its version and what it does.
- In the Discovery tab, add each Kodi to Gladys.
The Language option picks the language of the feature names and of the texts the integration creates (French by default). Feature names are set when the device is added.
On its first start without any address, the integration searches the network once by itself. A scan from the Discovery tab searches again.
The Kodi device
One device per Kodi, named as Kodi names itself (Settings → Services → General → Device name). The slot number is its identity: a Kodi that changes address keeps its device and its history.
| Feature | Type | Content |
|---|---|---|
| Playback | text | Playing, Paused, Stopped, Off or unreachable |
| Now playing | text | Movie (2024), Show S01E02 – Title, Artist – Song... |
| Media type | text | Movie, TV episode, Music, TV channel, Video, None |
| Progress | percentage | Position in the media, 0 for a live stream |
| Time left | minutes | Until the end of the media, 0 for a live stream |
| Volume | slider 0–100 | Kodi's volume, follows the remote |
| Play, Pause | buttons | Resume, pause |
| Stop | button | Stops playback |
| Previous/Next | buttons | Previous or next item of the playlist |
| Mute | button | Mutes or unmutes |
"Video" is what Kodi plays outside its library: a file opened from a folder, a stream, an add-on. Movies and episodes of the library are "Movie" and "TV episode".
Kodi reports its changes in real time (port 9090); while something plays, the progress is read every 10 seconds. With port 9090 closed, everything is read every 10 seconds over HTTP.
Dashboard widget
The Kodi widget (choose the Kodi in its settings) shows the artwork of what plays (when it comes from the library), the title, the media type, the state, the position, the end time and the volume. Its buttons follow the media: play/pause, then stop (video) or next (music), and volume down / up by 5 %.
Without artwork, a progress gauge takes its place once the device is added to Gladys.
Scene triggers
| Trigger | When |
|---|---|
| Playback started | Kodi starts a media after nothing played, or the next one of a list |
| Playback paused | Kodi pauses |
| Playback resumed | Kodi resumes after a pause |
| Playback stopped | Playback stops or reaches its end, and nothing follows |
Each trigger can be limited to one Kodi and to some media types (movie, TV episode, music, TV channel, other video). Variables for the next steps: Title, Media type, Kodi name, and for a stop, Reached the end.
Between two episodes of a playlist, Kodi stops then starts again within a tenth of a second: the integration waits 1.5 seconds before saying "stopped", so the next episode is a "started" and the lights do not flash.
The triggers follow what Kodi really does, whatever started it: the remote, the widget or a scene action. Nothing fires for what was already playing when the integration started, nor when Kodi is turned off.
Scene actions
| Action | What it does |
|---|---|
| Control the playback | Play, pause, play/pause, stop, next, previous |
| Set the volume | Volume from 0 to 100 |
| Mute or unmute | Mute, unmute or toggle |
| Show a notification on Kodi | A message with a title in the corner of the screen |
| Play a media | A file, a folder or a stream, by its path or URL as Kodi knows it |
| Update the library | Kodi scans its video or music sources for new media |
| Read what Kodi plays | State, title, media type, progress, minutes left, volume |
"Control the playback" returns Applied: false when nothing was playing, without failing the
scene. "Read what Kodi plays" gives the next steps what they need for an "only continue if"
condition: state (off, stopped, playing, paused), media type (movie, episode, music,
tv, video)...
Scene examples
- Movie night: trigger "Playback started" on the living room Kodi, media type Movie and Other video → dim the living room lights to 10 %. Trigger "Playback paused" → lights to 50 %. Trigger "Playback resumed" → back to 10 %. Trigger "Playback stopped" → lights to 100 %.
- Doorbell: when the doorbell rings → "Show a notification on Kodi" ("Someone at the door") and "Control the playback: pause".
- Bedtime: at 11:30 pm → "Read what Kodi plays", only continue if the state is
stopped→ turn off the TV plug. - New downloads: when your download box says it finished → "Update the library" (videos).
Do not start a playback from a "Playback started" scene: it would start itself again and again.
Troubleshooting
- "no answer (turned off, or remote control disabled)": Kodi is off, or "Allow remote control
via HTTP" is off, or the address or port is wrong. Open
http://<address>:8080in a browser: Kodi's web interface (or its login prompt) must appear. - "user name or password refused": check the user name and password of Settings → Services →
Control. An empty user name means
kodi. - "password refused by the web server, no artwork": everything works through port 9090, but the artwork comes through the web server: fix the password.
- "Test the connection" says "no live updates": turn on "Allow remote control from applications on other systems". Kodi's port 9090 cannot be changed from its menus.
- Nothing found on the network: turn on "Announce services to other systems", or type the address. The search needs Gladys on the same network as Kodi (Docker in host network mode, the usual setup).
- No artwork in the widget: Kodi only serves the artwork of its library; a file opened from a folder has none. An image over 300 KB is not shown either.
- "Update the library" does nothing: Kodi only scans the sources whose content type is set (Videos → Files → the source → Set content).
Limits
- Three Kodi at most.
- The WebSocket port is 9090 (Kodi's default, only changed in
advancedsettings.xml). - No power on/off: Kodi cannot be woken up through its interface. A Kodi turned off shows "Off or unreachable" and fires no trigger.
- Pictures (slideshows) are ignored; when music plays behind a video, the video wins.
- The artwork is shown when Kodi serves it under 300 KB (Kodi caches posters at 720 px).
- Not affiliated with the Kodi Foundation (XBMC Foundation), owner of the Kodi trademark.
Configuration settings
These are the settings Kodi asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Connect your Kodi | section | No | In Kodi, open Settings, Services, Control and turn on "Allow remote control via HTTP" and "Allow remote control from applications on other systems". Then click "Find Kodi on the network" below, or type its address. Up to three Kodi. |
| Kodi address | string | No | IP address of the device running Kodi. Add :port if its web server does not use 8080. |
| User name | string | No | Of Kodi's web server. Empty: kodi. |
| Password | secret | No | Leave empty if Kodi asks for none. |
| Kodi 2 (optional) | section | No | Another Kodi, set up the same way. |
| Kodi address 2 | string | No | |
| User name 2 | string | No | |
| Password 2 | secret | No | |
| Kodi 3 (optional) | section | No | Another Kodi, set up the same way. |
| Kodi address 3 | string | No | |
| User name 3 | string | No | |
| Password 3 | secret | No | |
| Options | section | No | Language of the names and texts the integration creates (feature names are set when a device is added). |
| Language | select | No |
How to install Kodi in Gladys
- In Gladys, open Integrations: Kodi appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/guim31/gladys-kodi:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/guim31/gladys-kodi.
Kodi requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Kodi is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.
- Browse all external integrations
- Discover the native integrations built into Gladys
- Build and publish your own external integration
- Source code on GitHub — source of this documentation