Roon API - Unique ID, IP Address or MAC of zone/bridge

Hi,

I’m currently building a RoonBridge running on Linux, which utilises an Orchard Audio Pecan Pi DAC. Similar to ROPIEE.

I am now trying to add some remote control functionality using Infra Red. I’d like to write some code to identify which Zone the bridge is on the Roon Core, I was hoping to utilise the IP address, but at the moment I can’t see that this is returned by the API, specifically the method which returns all zones.

The reason I would like to do this is to keep the bridge fairly “dumb”. I don’t want to have to configure the Bridge, on the bridge it’s self. So was hoping to make it identify which zone the bridge is associated with so that it can select and control the right zone/itself.

Does anyone know of a way I can identify which zone the bridge is using the API or some other data on the bridge? I had a look at the various settings and uniqueID files, but they did not seem to provide what I needed to match the ZoneID.

Thanks

Maybe you can loop through the outputs of the different zones and check the display_name of the output (assuming that this is constant for your use case).

To create something that is generally usable it might be better to create a zone-dropdown via the Settings API and let the user select the correct zone.

Thanks for the suggestion. I have also made some progress.

I think you are referring to the display_name (“snd_rpi_rpi_dac”) within source_controls? The other display_name (“Shop”) item appears to be used for identification of the Zone as defined by the user and is out of my control.

The source_controls display name will probably be the same in most instances as it refers to the hardware device enabled on the Pi, so in the case of the PecanPi, it is “snd_rpi_rpi_dac”:

"zone_id": "16013080d5218d86631389e423ada731ca6c",
      "display_name": "Shop",
      "outputs": [
        {
          "output_id": "17013080d5218d86631389e423ada731ca6c",
          "zone_id": "16013080d5218d86631389e423ada731ca6c",
          "can_group_with_output_ids": [
            "17013080d5218d86631389e423ada731ca6c"
          ],
          "display_name": "Shop",
          "source_controls": [
            {
              "control_key": "1",
              "display_name": "snd_rpi_rpi_dac",
              "supports_standby": false,
              "status": "indeterminate"
            }
          ]
        }

I have found, since I originally posted, that in the folder “/var/roon/RAATServer/Settings”, there is a device file created for each output on the bridge. This file contains the unique_id for the zone:

{
  "unique_id": "21d58030-868d-1363-89e4-23ada731ca6c",
  "output": {
    "force_max_volume": true,
    "name": "snd_rpi_rpi_dac",
    "type": "alsa",
    "dsd_mode": "none",
    "device": "hw:CARD=sndrpirpidac,DEV=0"
  },
  "volume": null,
  "external_config": {}
}

This unique_id is actually in the zone_id in the returned list of zones via the API, although it appears that the encoding method is slightly differently, so I can use this to allow the bridge to identify its self for control purposes.

"unique_id": "   21d58030 868d 1363 89e4 23ada731ca6c"
"zone_id": "1601 3080d521 8d86 6313 89e4 23ada731ca6c"

I’ll explore this option for now and see how I go.

Hi,

By way of an update, I was intending to use the web service extension to facilitate IR control, hence the reason I needed to know the zone_id of my bridge, but in the end have decided to probably take a different approach, which uses the linux event system.

This did not stop me however from implementing a script to workout and set the zone_id on the bridge. I have create a gist on github, which may be useful to someone, the code does not paste well here.

Cheers