Return Sample Rate / Quality Info via API

Might be cool to change a physical lamp colour to match the Roon Quality icon.

If you returned the info along with the now_playing details in the API it would be pretty easy to do this.

4 Likes

Lol, but yeah kinda cool

Just chiming in to voice support for this. One of the key components of Roon is the path quality status, so having it in the API would be highly useful.

Also props to @GregD for getting The Python API extended into a core module for one of the most recent Home Assistant releases. I was literally going to sit down this weekend to implement this in HA using the pyroon module and then found it in there. How this isn’t huge news for both HA and Roon is kind of baffling as you can literally fully automate Roon in any scenario you can imagine now, from wake up music to entrance themes to linking your physical media to Roon playback with rfid or nfc tags (and I’m a little jealous you got it in there before I got a chance to take a crack at it).

Roon should be shouting from the sky that someone did all the heavy lifting for them for free!

2 Likes

@Joselito_Tagarao thanks for the kind words - I really just finished off the work that @Marcel_van_der_Veldt started.

But I agree - HA integration adds a great deal to Roon, and without the hassle of setting up the roon integration framework in docker. Of course you do need a HA system (usually a dedicated Pi) - but that’s very east to set up these days.

At some point I will post a video of HA starting up my tube power amp which might help people see some of the possibilities.

Once HA sees the relevant zone playing, if the amp is off, it pauses the player - changes the phillips hue lamp above the amp to purple (waiting) turns on the power amp and DAC (via WeMo and zwave switches) waits 30 seconds for the tubes to warm up, then unpauses the player and changes the hue lamp to white (ready).

I have another zone connected via Broadlink IR blasters which will turn on and off the relevant amp and select the correct inputs when the relevant zone starts playing.

The new HA media browser looks great - I’ve started looking at the integration.

And if you’re inclined, some help would be gratefully received. I dropped Marcels zone group support to get the first release through the review process - so that would be great to add back in (the HA spotify - has this - so there is a model to follow) plus my media browser support is just a POC - so feel free to pick that up if you fancy (can share my WIP).

I’m interested but it’ll probably be awhile before I can contribute anything meaningful as I’m in the beginning stages of walking through the code. I pulled down the latest HA and pyroon from GitHub since I was trying to pick apart exactly what the format the HA/roon component was expecting for media_content_id and it looks fairly forgiving in that you just have to match on strings, which is pretty straightforward.

That however started a rabbit hole though of figuring out how exactly the pyroon module implements all the browse_* methods, and that’s got me digging through the structure of the json it’s sending to the Roon API (specifically the command and options in the body of the request) in an attempt to understand what the Roon js api is expecting. I’m already pretty rusty with my js but man that Roon API is… not the clearest. Props for figuring that out and layering some far more sane Python methods on top.

1 Like

That code is a bit difficult to follow, actually made more sense when I started to look at adding the media browser.

Basically the roon api is designed for browsing, and then picking something to play.

The code you’re looking at does the best it can to use the browse api to find what you want to play via the browse api, and then load it to play.

another +1 for this. would love to make my lamp change colors in accordance with media quality.

roon + python (pyroon) + lambda functions = alexa changing my lights based on the parameters of the music.