Skip to main content

PyKodi

An async python interface for Kodi over JSON-RPC. This is mostly designed to integrate with HomeAssistant. If you have other needs, there might be better packages available.

Installation

You can install PyKodi from PyPI:

pip3 install pykodi

Python 3.7 and above are supported.

How to use

from pykodi import get_kodi_connection, Kodi
kc = get_kodi_connection(<host>, <port>, <ws_port>, <username>, <password>, <ssl>, <timeout>, <session>)
# if ws_port is None the connection will be over HTTP, otherwise over WebSocket.
# ssl defaults to False (only relevant if you have a proxy), timeout to 5 (seconds)
# session is generated if not passed in

# you can also pass in your own session
await kc.connect()

kodi = Kodi(kc)

await kodi.ping()
properties = await kodi.get_application_properties(["name", "version"])

await kodi.play()
await kodi.volume_up()
await kodi.pause()
...

# over WebSocket you can subscribe to Kodi notifications
def on_play(sender, data):
    print(data["item"])

unsubscribe = kc.subscribe("Player.OnPlay", on_play)
...
unsubscribe()

# and get a call when the connection is lost, but not after close()
def on_disconnect(error):
    print("Connection to Kodi lost:", error)  # usually None, a network drop included

remove = kc.on_disconnect(on_disconnect)
...
remove()

Stream and HDR details

players = await kodi.get_players()
info = await kodi.get_stream_info(players[0])

info["currentvideostream"]                  # {"codec": "hevc", "width": 3840, "height": 2160, ...}
info["infolabels"]["VideoPlayer.HdrType"]   # "dolbyvision", "hdr10", "hlg" or "" ("hdr10plus" from Kodi 22)
info["infolabels"]["System.ScreenResolution"]
info["hdrhints"]                            # ["dolbyvision", "hdr10"], taken from the file name

The info labels are returned as Kodi reports them. Labels that the running Kodi version does not know are empty strings. hdrhints lists the HDR formats named in the file name, because Kodi 21 reports HDR10+ as hdr10 and does not report the HDR10 base layer of a Dolby Vision stream.

Metadata

Release files for pykodi 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykodi 0.3.0
File Size Uploaded Provenance Actions
pykodi-0.3.0.tar.gz 17.8 kB With provenance Details for pykodi-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pykodi 0.3.0
File Interpreter ABI Platform Actions
pykodi-0.3.0-py3-none-any.whl Python 3 none any Details for pykodi-0.3.0-py3-none-any.whl

Total release size: 27.5 kB

Release files / pykodi-0.3.0.tar.gz

Download URL pykodi-0.3.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c0d995be5ee58436d18c17d70f49264b8e50eba6d728f0b366ce0984f43bf081
BLAKE2b-256 checksum
How to use checksums
e4cc41a3a864c032fdf03ddb65e4aa59e5e38a9bd1ff803f40a7870df3986a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pykodi-0.3.0-py3-none-any.whl

Download URL pykodi-0.3.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecd109a460179fdf1e15e4aee4d6cc9e3b5ad1f63fb1e9a6913d2d033c30a75c
BLAKE2b-256 checksum
How to use checksums
7d7f824d9d17b51243493abd1644c30c782fc9199a9b0d6f2feb9696d1cc722a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for pykodi 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pykodi-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page