I have a source control working. I’d like to add a feature that puts my source in standby if nothing it playing to it for 30 minutes. I can get this working by watching the zones_changed on the RoonApiTransport to see when any zone changes state, then see if the zone contains an output that contains my source control. That works, but I can’t reliably determine whether a source control is my source control without using some heuristics, because there is no unique identifier for the source control.
Can anyone tell me how to correlate the source control object in a callback with the source control service object that you provide to the API?
I have one roon ready device (a WiiM) that supports standby.
Roon already does the detection - you specify the standby time in Settings / Audio Device / Auto Standby.
I’ve not used the source control api ( I have used the volume control api), but I’d hope that if roon sees you’ve implemented a source control - standby function - it would turn on the option on that endpoint.
So with luck you’d just need to turn it on in settings!
Enticing! But unfortunately that setting doesn’t show up for me.
Would be nice if it did. But even then I’d still like my extension to be able to reliably detect that a zone or output callback was referring to the output my extension controlled.
So back to your question - the only relevant experience I had was using the volume control API.
I started by thinking I could register one - and reuse it across endpoints - but I couldn’t find a way to make that work - so I ended up registering one for each endpoint (and including the endpoint name in the volume control name).
You could try something similar.
It’s possible my original design could have worked, but the documentation and examples weren’t enough to show me how…
That’s what I do - I name the source control and volume control with names that contain “Benchmark” (for my Benchmark DAC) and of course I know what they are because I wrote them and I only have one DAC. It just feels fragile.
The zones and outputs callbacks from RoonApiTransport include a UUID for each output and each output has a list of source controls. But I can’t reliably correlate the UUID to my endpoint, and then I can’t reliably determine whether the source control really is mine.
It would be nice if the source control API allowed setting some unique id on it which you could then see in the callbacks. The control_key field looks like it should work, but setting it causes my object to not get registered.