Getting settings from Setting API?

This is my code: https://github.com/615283/roon-discord-rp/blob/master/roon-discord-rp.js

As you can see, I have configured a settings option, setting a zone. I need to get this to use in my program, how can i do this?

You can access the set zone via my_settings.zone.

Is that getting it from the setting variable or the title variable when i push to the layout?

When using my_settings.zone.zone_id, I get undefined. @Jan_Koudijs

The name you specify behind setting: is the field name within the settings object, the title is the text string that gets displayed in the settings dialog.

my_settings.zone should get a value after you have selected a zone and saved it. Within the makelayout function you should use the local settings parameter.

@Jan_Koudijs now using https://github.com/615283/roon-discord-rp/blob/master/roon-discord-rp.js but still getting undefined when trying console.log(my_settings.zone.zone_id)

At first start my_settings.zone will be undefined because no zone selection has taken place. So you have to check if zone is actually defined before accessing it. Something like:

if (my_settings.zone && zone.zone_id === my_settings.zone.zone_id)

If that’s still not working then you have to add more console logging to see what is going on.

You also have some duplicate code (two makelayout functions, two roon.start_discovery calls), this can give unexpected behavior.

Guess this is all I can do, I hope it helps.

I find no zone_id in the zone. I found this
{
“output_id”: “1701f205bee303a1977878f08b35fbb43fe7”,
“name”: “AudioVolver”
}
Why output_id instead of zone_id?