Skip to main content

roonctl

PyPI Python versions License: MIT CI

Control a Roon Core from the command line, or from an AI agent, without a daemon, a GUI, or a vendor SDK. One WebSocket, one command, one answer.

$ roonctl zones
ZONE              STATE     VOLUME  NOW PLAYING
Zone One          playing   42%     Track Title — Artist Name
Zone Two          stopped   —       —

Unofficial. Not affiliated with or endorsed by Roon Labs. Roon is a trademark of Roon Labs. roonctl speaks Roon's documented Extension API and is not a Roon product.

Why roonctl

  • Built for agents. JSON whenever stdout is not a TTY, stable exit codes, a published error schema, commands --json and schema for introspection, --dry-run on every state-changing command, and name resolution that fails loudly instead of guessing. It ships a skill that installs into about thirty agent harnesses.
  • No daemon, no state. Each invocation opens one connection, acts, verifies what it can, and exits. There is no background service to keep alive and nothing to restart after an upgrade.
  • Wide coverage. Discovery, pairing, zones and outputs, transport, volume, mute and standby, grouping and transfer, queue reading and play-from-here, browse and search, filtered play-all, arbitrary item actions, album art, and a live NDJSON event stream.
  • Small and typed. Two runtime dependencies (click, websocket-client), a typed client for Roon's documented Extension API, strict mypy, and a test suite that runs against a mock Core with no Roon required.
  • Honest about the API. Where Roon's public API cannot do something, roonctl says so and exits with a stable code instead of reaching for unsupported protocols.

roonctl talks to Roon's official Extension API on ws://<core>:9330/api. It does not use Roon's internal port-9332 protocol, which Roon does not support for third parties.

Agent quick start

roonctl discover            # find a Core on the LAN, or pass --host later
roonctl pair                # tap Enable in Roon > Settings > Extensions
roonctl commands --json     # every command, flag, example and exit code
roonctl zones --json        # one JSON document on stdout
roonctl skill install --target detected

Read docs/agent-usage.md for the short contract, or roonctl skill show for the same information packaged for an agent.

Requirements

  • Python 3.11, 3.12 or 3.13
  • Linux, macOS or Windows 10/11
  • Roon 1.8 or newer (developed against Roon 2.x)
  • Network access from the machine running roonctl to the Core's port 9330

Platforms

roonctl runs on Linux, macOS and Windows. The full suite, lint, types and docs checks run on every push for every combination below:

OS Python Interface discovery
Linux (ubuntu-latest) 3.11, 3.12, 3.13 ioctl interface table, /proc/net/route
macOS (macos-latest) 3.11, 3.12, 3.13 ifconfig -a, route -n get default
Windows (windows-latest) 3.11, 3.12, 3.13 PowerShell Get-NetIPAddress / Get-NetRoute

The macOS and Windows jobs also run live checks against the runner's real network: the interface enumerator must return loopback plus a real address with a real netmask, and the default-route lookup must name an interface. No test needs a Roon Core.

Windows needs no extra runtime dependency: roonctl asks the built-in Windows PowerShell 5.1 for one JSON report (addresses, adapter state, default route), parses it, and falls back to the hostname probe if PowerShell is unavailable.

Install

Cross-platform, from PyPI:

uv tool install roonctl
# or
pipx install roonctl

From the repository (pin a release tag; main tracks unreleased code):

uv tool install "git+https://github.com/vikesh-c/roonctl.git@v1.0.0"

Or run the installer, which uses uv tool and can also install the bundled agent skill. install.sh is POSIX shell and supports macOS and Linux only; on Windows use uv tool install or pipx install above:

curl -fsSL https://raw.githubusercontent.com/vikesh-c/roonctl/v1.0.0/install.sh | sh

The installer accepts --no-skill and --ref REF (a tag or branch); it installs the tag v1.0.0 by default.

Check the install:

roonctl --version
roonctl commands --json

Quick start

  1. Run any command. On the first run, roonctl sweeps every up interface (multicast, broadcast, a bounded unicast probe of the local /24s, and Tailscale peers if tailscale is installed), uses the only Core it finds, and remembers it by its stable unique id:

    roonctl discover
    

    If the Core is on a network with no route from this machine, or several Cores answer, pass the host or save one explicitly:

    roonctl config core add main --host 192.0.2.10
    roonctl config core use main
    
  2. Pair. This opens a connection and waits while you approve the extension:

    roonctl pair
    

    In Roon: Settings → Extensions → roonctl → Enable. The token is stored with mode 0600 next to the config file and is never printed.

  3. Use it:

    roonctl zones
    roonctl now --zone "Zone One"
    roonctl volume --zone "Zone One" --set 30
    roonctl play --zone "Zone One" --search "album title"
    roonctl play-all --zone "Zone One" TIDAL "Your Favorites" Tracks --match-subtitle "Artist Name" --shuffle
    roonctl pause --zone "Zone One"
    

    --search drills from the best hit (or from --type album|artist|track|playlist) into the item's action list, then runs the action in the same Core connection.

Commands

Run roonctl commands --json for the machine-readable tree, or roonctl <command> --help for options. The full reference is in docs/commands.md.

Area Commands
Setup discover, pair, status, config (show, path, init, core, profile)
Discovery every up interface, per-interface broadcast, a bounded unicast sweep, TCP 9330 registry fallback, Tailscale peers; one Core is used automatically, several are listed
Read zones, outputs, now, queue, browse, search, albums, artists, tracks, genres, composers, playlists, internet-radio
Transport play, play-radio, play-all, resume, pause, playpause, stop, next, previous, seek, shuffle, loop, auto-radio, pause-all
Volume volume (--set, --by, --step, --raw), mute (on, off, toggle, --all)
Zones group, ungroup, transfer, standby, toggle-standby, convenience-switch
Queue queue, play-from-here
Media art, image (both support --original)
Live watch
Items action (run any named browse action on an item)
Agent commands, schema, skill (show, path, targets, install)

Every state-changing command supports --dry-run, which prints the exact request it would send and exits without changing the Core. It still connects, so an unreachable Core fails with exit 3 rather than pretending the plan would have worked.

Examples

# What is playing everywhere?
roonctl zones --json

# Check what a play would do before it replaces the queue
roonctl --dry-run play --zone "Zone One" Library Albums "Album Title"

# Play the best search hit
roonctl play --zone "Zone One" --search "album title" --type album

# Queue a filtered set without touching the current queue
roonctl play-all --zone "Zone One" Library Albums --match-field subtitle --match "Artist Name" --action queue

# Stream events as NDJSON
roonctl watch --zone "Zone One" --duration 60 --json

# Save album art next to a report
roonctl art --zone "Zone One" --out cover.jpg

Configuration

Precedence, highest first: command-line flags, environment variables, the selected profile, the config file.

roonctl uses the same ~/.config/roonctl directory on every OS, so one config format and one set of instructions work everywhere:

OS Default directory
Linux, macOS $XDG_CONFIG_HOME/roonctl, else ~/.config/roonctl
Windows %XDG_CONFIG_HOME%\roonctl when set, else %USERPROFILE%\.config\roonctl
Path Purpose
.../roonctl/config.toml Cores, profiles, timeout
.../roonctl/tokens.json Pairing tokens, protected per OS (below)

Token protection is per OS. On Linux and macOS tokens.json is created 0600 and status repairs a group- or world-readable file back to 0600. Windows has no mode bits: os.chmod only toggles the read-only attribute, so roonctl relies on the ACL that %USERPROFILE% inherits (the signed-in user, SYSTEM and Administrators). On Windows status reports "secure": true, "mode": null instead of pretending a chmod tightened an ACL. Keep the file inside your user profile.

Environment variables: ROONCTL_CONFIG, ROONCTL_TOKENS, ROONCTL_CORE, ROONCTL_HOST, ROONCTL_PORT, ROONCTL_ZONE, ROONCTL_TIMEOUT, ROONCTL_JSON.

default_core = "main"
default_profile = "evening"
timeout = 10.0

[core.main]
host = "192.0.2.10"
port = 9330

[profile.evening]
core = "main"
zone = "Zone One"
volume_step = 2

Profiles are named defaults, not separate Cores: roonctl --profile evening zones uses the evening zone when --zone is omitted.

Agent usage

JSON is the default whenever stdout is not a TTY, and --json forces it. --human forces the table view.

$ roonctl commands --json
$ roonctl schema zone_list
$ roonctl zones --json
$ roonctl --dry-run play --zone "Zone One" --item-key 1234
$ roonctl watch --zone "Zone One" --duration 60 --json

Rules the CLI keeps so an agent can rely on it:

  • One JSON document per invocation on stdout. Progress and warnings go to stderr. watch is the exception: one JSON object per line on stdout, as documented.

  • No prompts. Commands either work or fail; pair waits for a human tap in Roon, which is the only human step.

  • Stable exit codes. See the table below. The same codes appear in commands --json.

  • One error shape on stderr:

    {"error": {"code": "zone_not_found", "message": "...", "exit_code": 5, "hint": "...", "details": {}}}
    
  • No silent guesses. A zone name that matches two zones exits 6 with the candidate list; pass a full name or a zone_id.

  • Connect, act, exit. Each command opens one connection and closes it. There is no background process to keep alive. watch is the deliberate exception.

Exit Name Meaning
0 ok Success
1 error Unexpected failure
2 usage Bad arguments or configuration
3 connect Core unreachable
4 auth Pairing required or refused
5 not_found Zone, output, item, Core or schema does not exist
6 ambiguous More than one object matched
7 unsupported The Core or endpoint cannot do this
8 timeout The Core did not reply in time
9 refused The Core understood but declined
10 protocol The Core sent an unexpected message

The bundled skill teaches an agent the same contract. Install it for one agent, every agent detected on this machine, or every supported agent (about thirty, from Hermes and Claude Code to OpenClaw, Grok Build, Antigravity, opencode, pi and oh-my-pi):

roonctl skill install --target hermes
roonctl skill install --target detected
roonctl skill install --target all --dry-run
roonctl skill targets

Installing proves the file landed; loading it is the agent's job. Ten rows are load-proven: Hermes, Codex, Gemini CLI, opencode, oh-my-pi, pi, OpenClaw, Grok Build, Goose, and the shared ~/.agents/skills path. Each was listed by that agent's own discovery code, using a temporary install and no new login; the commands and output are in docs/skill-load-proof.md. skill targets --json marks those rows load_proven. Every other target is path-only: the path comes from that vendor's current docs, but the product was not installed here to load it. skill targets prints the confidence and the docs URL for every row.

Stability

roonctl follows semantic versioning. From 1.0, these are the stable interfaces, and a change to any of them needs a major version:

  • Command names and paths in roonctl commands --json.
  • Flags and parameters for those commands, including --dry-run and --json.
  • JSON output schemas published by roonctl schema <name>, including the error object. New optional fields are additive and may appear in a minor release; existing fields keep their name, type and meaning.
  • Exit codes and the error.code values listed in commands --json.

Human-readable tables are not a stable interface: use --json. The bundled skill's content may improve in a minor release; its command contract follows the rules above.

Safety

  • The pairing token grants control of every zone and read access to the library. It is written separately from config, never printed, and never included in error details or logs: 0600 on Linux and macOS, and inside the per-user profile's inherited ACL on Windows.
  • No control path retries. A retried "next track" is a double skip; a retried "play" can restart playback. If a reply is lost, the command fails and you decide.
  • --dry-run never opens a browse action that could start playback. For a leaf action passed with --item-key, pass --item-hint action so the dry run knows not to select it.
  • play with Play Now (and Play Album / Play Artist) replaces the zone's current queue, and transfer replaces the destination queue. Roon's API has no queue restore, so use action --action Queue or Add Next when you mean to add rather than replace.
  • Tests use a mock Core on loopback. Nothing in the default gate touches a real Core or your library.

Roon API limits

These are limits of Roon's public API, not of roonctl. They are reported honestly and not worked around with unsupported protocols.

  • The play queue is read-only: no remove-from-queue, no clear-queue, no reorder. play-from-here is supported, but Roon does not acknowledge it: the Core sends no reply and still jumps the queue. roonctl validates the id against the zone's queue before sending (--position N resolves a 1-based position), then verifies the now-playing item and fails with exit 9 if the zone did not move.
  • There is no liked/favourite flag in the API and no library add/like method. TIDAL "Your Favorites" is the streaming service's liked list; filter it with --match-title/--match-subtitle to act on "my liked X".
  • Radio cannot start from the now-playing object: the transport API has no radio method and now_playing is text-only. play-radio uses the Start Radio action on a resolved browse item, which is the only radio primitive the API offers.
  • The API does not expose the signal path (bit depth, sample rate, DSP), lyrics, Focus filters, or browse-side sort/filter. roonctl filters locally after reading a level.
  • Roon profiles cannot be switched through the API. roonctl profiles are CLI defaults, not Roon listening profiles.
  • Some smart playlists and streaming-service folders do not expose browsable items. browse and search show exactly what the Core returns.
  • internet-radio reads the Core's My Live Radio tree. A library with no saved stations returns one No Results placeholder row; that is an empty library, not a browse failure.
  • Extension registration requires the one-time Enable tap in Roon. There is no headless pairing.
  • Image fetch returns the bytes the Core provides; roonctl does not upscale or cache.

Development

git clone https://github.com/vikesh-c/roonctl.git
cd roonctl
uv sync --locked --extra dev
./scripts/check.sh

scripts/check.sh is the gate: uv sync --locked, ruff check, ruff format --check, strict mypy, the generated command docs check, and pytest with branch coverage (minimum 90%, read from pyproject.toml). The tests start a fake Roon Core on loopback that speaks the real WebSocket and MOO/1 framing, so they need no Roon.

docs/live-test-matrix.md records the real-Core checks with pass / dry-run-only / API-limit status and the reason for each. docs/api-coverage.md maps every public Roon API method to its command and lists the gaps no client can close.

Live tests are opt-in: ROONCTL_LIVE_HOST=<host> pytest -m live. They are short and quiet, record what they change, and restore it.

See ARCHITECTURE.md for the design and CONTRIBUTING.md for the workflow.

License

MIT. See LICENSE.

Roon is a trademark of Roon Labs. roonctl is an unofficial community project, not affiliated with or endorsed by Roon Labs.

Metadata

Release files for roonctl 1.0.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 roonctl 1.0.0
File Size Uploaded Provenance Actions
roonctl-1.0.0.tar.gz 300.5 kB With provenance Details for roonctl-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 431.4 kB

Release files / roonctl-1.0.0.tar.gz

Download URL roonctl-1.0.0.tar.gz
Size 300.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c7d46a136478c58d7ae3cc46f2ed920118cdfbcc07cc12339e70cb74a249c056
BLAKE2b-256 checksum
How to use checksums
fd460122dbfdc1ef8ae2fa8ae4e98cb4cae4232441604bb8b541fdc47f9ae294
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 Dec 6, 2026.

Transparency log

Release files / roonctl-1.0.0-py3-none-any.whl

Download URL roonctl-1.0.0-py3-none-any.whl
Size 130.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
577bdfd3affe4c56d0b26728cf4b6325ad613688440cb414c70f954d44d1ea6f
BLAKE2b-256 checksum
How to use checksums
6331ccd2a6b027ee38a6bef59bb1f2417c6811150a5a0db3b0a131b99e0d856a
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 Dec 6, 2026.

Transparency log

Security for roonctl 1.0.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 roonctl-1.0.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 Dec 6, 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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