LinuxCommandLibrary

kodi-send

Send commands to Kodi

TLDR

Quit Kodi

$ kodi-send [[-a|--action]] Quit
copy

Reboot the system
$ kodi-send [[-a|--action]] Reboot
copy

Send an action to a remote host
$ kodi-send --host [192.168.0.1] --port [9777] [[-a|--action]] [Quit]
copy

SYNOPSIS

kodi-send [-a address] [-p port] [-c|--connect] [-v|--verbose] {sendaction action | sendtext text | sendcommand jsonrpc_command}

PARAMETERS

-a address
    Specifies the IP address or hostname of the Kodi instance to connect to. If omitted, `localhost` or the default broadcast address is often used.

-p port
    Defines the port number for communication. The default is typically 9777 for UDP (EventServer) and 9090 for TCP (JSON-RPC, if --connect is used).

-c | --connect
    Forces kodi-send to establish a TCP connection instead of the default UDP. This is generally more reliable.

-v | --verbose
    Enables verbose output, displaying detailed information about the communication process and what is being sent.

sendaction action
    Sends a predefined Kodi action, such as 'Play', 'Stop', 'Home', 'Right', or 'ActivateWindow(Videos)'. Actions simulate built-in button presses or system commands.

sendtext text
    Sends a string of text to Kodi, useful for populating input fields like search bars, login prompts, or on-screen keyboards.

sendcommand jsonrpc_command
    Allows sending a raw JSON-RPC command directly to Kodi. This requires Kodi's JSON-RPC server to be enabled and configured, typically accessible over TCP.

DESCRIPTION

kodi-send is a lightweight command-line utility designed to interact with a running Kodi media center instance. It allows users to send various commands, actions, and text inputs directly to Kodi, making it ideal for scripting, automation, or remote control applications. It typically communicates with Kodi using the EventClient network protocol, often over UDP, but can be configured for TCP. Common uses include sending keyboard presses, built-in Kodi actions (like Play, Pause, Stop), text input for search fields, or specific Kodi JSON-RPC commands. This tool provides a powerful way to integrate Kodi into home automation systems or create custom control interfaces without needing to use the full JSON-RPC API directly from a programming language.

CAVEATS

For kodi-send to function, the Kodi EventServer (for actions and text) or JSON-RPC server (for sendcommand) must be enabled and accessible within your Kodi settings. Ensure no firewall rules are blocking the specified UDP or TCP ports. Using UDP (the default) is connectionless and less reliable than TCP; consider using the -c option for critical commands to ensure delivery. This utility sends commands without immediate feedback on execution success, so careful scripting and error handling are advised.

COMMON ACTIONS

Many common Kodi operations can be triggered using the sendaction parameter. Examples include:
kodi-send sendaction Play
kodi-send sendaction Stop
kodi-send sendaction Right (simulates right arrow key)
kodi-send sendaction ActivateWindow(Home) (navigates to the Home screen)
A comprehensive list of available actions can often be found in the Kodi wiki or its source code.

JSON-RPC INTEGRATION

The sendcommand option unlocks advanced control by allowing direct interaction with Kodi's powerful JSON-RPC API. This enables fetching information, managing playlists, and executing complex functions not available via simple actions. For example:
kodi-send sendcommand '{"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid":1},"id":1}'
Using JSON-RPC requires a deeper understanding of Kodi's API, typically found in the official Kodi JSON-RPC API documentation.

HISTORY

The kodi-send utility is a long-standing component of the Kodi (formerly XBMC) ecosystem, designed to provide a straightforward command-line interface for interacting with a running Kodi instance. It emerged as part of the EventClient tools, enabling external applications and scripts to control Kodi via its built-in EventServer. Its development has mirrored Kodi's own evolution, consistently offering a simple yet powerful method for automation and remote control, filling the gap for quick, scriptable interactions without requiring complex API integrations.

Copied to clipboard