Where can I find the Roon Extension Status project (for playback detection)?

I’m trying to use a PowerShell or Python script to detect playback status from Roon to prevent my media PC from going to sleep while music is playing.
I saw mentions of a roon-extension-status package or server, but none of the GitHub links seem to work anymore.
Is there an up-to-date source, or a recommended way to query Roon’s playback status locally (localhost)?

Have you tried Roon commandline?
Best DrCWO

No I haven’t tried it yet. Is it true it’s not available on windows? Can I use the WLS environment (Ubuntu) instead?

Thanks for the advice.

Jon

As I’m not the developer I can’t give more details. Please contact the developer here

Roon Command Line Control version 2 - Tinkering / Roon API - Roon Labs Community

Best DrCWO

RoonCommandLine may work under Microsoft’s Windows Subsystem for Linux (WSL) but it is untested and unsupported as I do not have Windows installed anywhere. Sorry, I am a Linux/Mac guy. But if you do get it working under WSL then let me know and I will document the procedure for others.

Currently working on it. I keep you Posted!

If you want to write in Python, you can use my python api wrapper. Details here

There are some code examples to get you started.

Hi! I’m trying to use your roonapi with RoonCommandLine, but it requires token_path support that’s only in the Git version of the repo. Would you be willing to publish a 0.1.7 release to PyPI with the latest changes? That would make integration much smoother. Thanks!

Jon, Is this a question for me or @Ronald_Record?

Ha yes it is for Ronald. Thanks!

Hi Ronald,
Thanks for your continued work on RoonCommandLine! I just wanted to share that we got the Python roonapi.py working beautifully on Windows 11 PowerShell.

:white_check_mark: Persistent token.json approval works after patching in support for the token_path argument
:white_check_mark: Scripts now run from a static C:\Scripts folder with playback state detection working reliably
:white_check_mark: Roon only asks for extension approval once — after that, token re-use is seamless
:white_check_mark: Currently integrating it into a PowerShell-based auto-sleep scheduler

Happy to share screenshots or details if it helps others working on Windows. Keep up the great work!

2 Likes

@Jon_Spijker that is great news, congratulations on getting it working on Windows! I would be interested in any details you could share, especially any gotchas on deployment in that environment. My goal would be to document this well enough so other users could replicate.

Nice work!

Hi @Ronald_Record,

Thanks again for your continued work on RoonCommandLine. I’m happy to share the steps we followed to get the Python roonapi.py working successfully on Windows 11 using PowerShell.

Goal: playback detection using the Roon Python API with persistent token support and integration into a PowerShell-based auto-sleep routine.

Setup details:

  1. Python environment (Windows 11)
  • Installed Python 3.11 from python.org

  • Created a virtual environment:

python -m venv C:\roonenv

  • Activated it via PowerShell:

C:\roonenv\Scripts\Activate.ps1

  1. Installed required modules
    Inside the virtual environment:

pip install websocket-client requests

  1. Patched roonapi.py
    We modified the file at:

C:\Windows\System32\roonenv\Lib\site-packages\roonapi\roonapi.py

to accept a token_path argument in the RoonApi constructor and to load/store the token persistently.
This prevents the need for extension approval every time the script is run.
4. Playback detection script

Saved in C:\Scripts\check_playback.py.

It loads the token (if present), initializes the API, and prints the playback state of each zone.

Example snippet:

from roonapi import RoonApi
import os, json

appinfo = {
“extension_id”: “playback-checker”,
“display_name”: “Playback Status Checker”,
“display_version”: “1.0”,
“publisher”: “xxx”,
“email”: “noreply@example.com”,
}

token_path = os.path.expandvars(“C:\Scripts\roon_token.json”)
host = “127.0.0.1”
port = 9330
token = None

if os.path.exists(token_path):
with open(token_path) as f:
token = json.load(f)

roonapi = RoonApi(appinfo, token, host, port, token_path)

zones = roonapi.zones
for zone in zones.values():
state = zone.get(“state”, “unknown”)
print(f"{zone[‘display_name’]} is currently: {state}")

Results:
• Extension approval is now persistent thanks to the patched token path
• The script runs reliably from a static folder (C:\Scripts)
• Works perfectly with PowerShell automation (we’re integrating it into a sleep scheduler)

Happy to share the exact patch or screenshots if helpful for documenting it for others. Let me know how I can contribute to that.

Best regards,
Jon Spijker

2 Likes

Thanks @Jon_Spijker !

I have started a RoonCommandLine on WSL notes at https://github.com/doctorfree/RoonCommandLine/blob/master/WSL.md.

Yes, I would like to see your patch if you can share it. Nice work!

Hi Ronald,

As promised, here’s the Gist with my patch for SmartSleep integration on Windows:

:link: gist.github.com/jonspijker/d9dfd12751b319ebf835ba02da0eb7c9

It includes:

  • The modified roonapi.py for Windows support
  • My SmartSleep.ps1 script that coordinates sleep behavior based on Roon API playback status
  • A brief README with explanation

Hope this helps others on Windows too. Happy to refine it further if needed!

Cheers,
Jon Spijker

Hi @Ronald_Record,

I’ve updated my Gist with the finalized version of my Windows-based SmartSleep automation for Roon + HQPlayer. It now includes:

  • :white_check_mark: A clean, patched version of roonapi.py with support for token_path
  • :white_check_mark: SmartSleep.ps1 PowerShell script with playback detection
  • :white_check_mark: A minimal Python script check_playback.py to detect active playback via Roon API
  • :white_check_mark: A README with setup instructions, Siri Shortcut integration, and Task Scheduler usage

:brain: Gist link: Patch: RoonCommandLine + SmartSleep on Windows (by Jon Spijker) · GitHub

It’s fully functional on my Windows 11 setup and may be helpful to others trying to implement idle-based sleep without interrupting playback.

Thanks again.

Best,
Jon

Hi Ronald,

Quick update from the Windows side — the RoonCommandLine project.

:white_check_mark: list_artists.py has been fully adapted for Windows with:

  • Proper argument parsing (-a, -z, -x, -q)
  • Full token path support via --tokenfile
  • UTF-8 handling and friendly error messages

:light_bulb: I’ve wrapped the script in a reusable PowerShell launcher (RunArtist.ps1) that lets any Windows user call it with simple flags like:

.\RunArtist.ps1 -a "Miles Davis" -z "HQPlayer_Jon"

Everything is tested and works perfectly with roon_token.json stored in .roonapi, just like on Linux.

Next step: adapting the rest of the .py tools (like list_albums.py, list_genres.py, etc.) for similar universal Windows usage.

Best,
Jon

Hi Ronald,

Just a quick follow-up — I’ve finalized and tested a fully working version of the SmartSleep integration for Windows. It includes:

  • Playback detection via check_playback.py (using the Roon API)
  • A mutex-protected SmartSleep.ps1 script with fallback audio detection
  • Optional Plex server activity checks
  • Logging to smartsleep.log
  • Manual override via a .flag file
  • Token-based Roon authentication support with a patched roonapi.py

You can find the full setup and scripts in this public Gist:
:link: Patch: RoonCommandLine + SmartSleep on Windows (by Jon Spijker) · GitHub

Hope this helps other Windows-based Roon users!

Best regards,
Jon Spijker

1 Like

@Jon_Spijker nice work! I have added a link to your gist in the RoonCommandLine readme. Could you also provide link(s) to list_artists.py and any other Python scripts you have enhanced? I will integrate your work into RoonCommandLine where appropriate.

Excellent work!

1 Like

Hi Ronald,

As promised, I’ve started adapting the Python scripts for Windows users and created PowerShell wrappers to simplify usage. I’ve published the first script (list_artists.py) along with a matching runartist.ps1 in a dedicated Gist:

:link: Windows-compatible RoonCommandLine script with PowerShell wrapper · GitHub

More will follow soon as I continue testing and converting the rest of the RoonCommandLine suite. Hope it’s useful for others too!

Best,
Jon