rgraciano / echo-sonos

Amazon Echo integration with Sonos
Other
712 stars 234 forks source link

Speaker Aliases #183

Open jer78 opened 7 years ago

jer78 commented 7 years ago

Is there a way to make alias’s for speakers? For instance I have one named Living Room but since it’s an open concept it would be nice to say Kitchen, Dining Room, Main Floor etc.

jer78 commented 7 years ago

Here's a hack that gets this working. I couldn't find a global place to put the following so I just put it in all the functions in the sonosProxyFactory.js file:

if(room == "bedroom" || room == "upstairs"){
      var room = "master bedroom" 
    }
    else if(room == "kitchen" || room == "main floor" || room == "downstairs" || room == "dining room"){
      var room = "living room"
    }

Here's an example:

sonosProxy.playlist = function(room, playlist) {
    if(room == "bedroom" || room == "upstairs"){
      var room = "master bedroom" 
    }
    else if(room == "kitchen" || room == "main floor" || room == "downstairs" || room == "dining room"){
      var room = "living room"
    }
    var room = encodeURIComponent(room);
    var playlist = encodeURIComponent(playlist);
    var path = `/${room}/playlist/${playlist}`;

    return makeCall(path);
};