0
Completed

To open the player Sonos via the name

Sergey (expert) 5 years ago in Tips and Tricks updated by Aleksandr Romanov (CTO) 2 years ago 1
You can launch the control of Sonos player, selecting it via the name when you pass to control, with the help of the changed script file (change it in JS module Sonos): Sonos_Control.js


Use the described method to call the player via the name of the group where it's located

Public_SelectGroupByName(name);
If the group isn't found? the other one won't be chosen.
The code of the method:
function SelectGroupByName(name) {     // если групп нет выходим 
    if(groups.length == 0) { 
        debug('groups.length == 0'); return; 
    } 
    // ищем id группы по имени 
    var index; 
    for (var i = 0; i < groups.length; i++) { 
        if(groups[i].name == name) { 
            index = i;
        break; 
        } 
    } 
    // если группу не найдем - выходим 
    if(index == undefined){ return; } 
    // подсветка 
    HighLightSelectedZone(index); 
    // отображение
    group = groups[index]; 
    // повторная подписка для получения актуального состояния плейера
    UnSubscribe(group.parent); 
    Subscribe(group.parent); 
    ToggleOpenVolumeGroup(group.members.length > 0); 
}