• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Limit Sonos module to only show a specific speaker

Scheduled Pinned Locked Moved Development
23 Posts 3 Posters 14.7k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    dinkybluebug245 @strawberry 3.141
    last edited by Aug 31, 2016, 6:32 PM

    @strawberry-3.141 Thanks for all your help.

    Really appreciate it.

    Marc

    S 1 Reply Last reply Aug 31, 2016, 6:36 PM Reply Quote 0
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @dinkybluebug245
      last edited by Aug 31, 2016, 6:36 PM

      @dinkybluebug245 is this what you mean by nested rooms?

      $.each(item.members, function (j, member) {
      					room += member.roomName + ', ';
      });
      

      Please create a github issue if you need help, so I can keep track

      D 1 Reply Last reply Aug 31, 2016, 6:38 PM Reply Quote 0
      • D Offline
        dinkybluebug245 @strawberry 3.141
        last edited by dinkybluebug245 Aug 31, 2016, 6:38 PM Aug 31, 2016, 6:38 PM

        @strawberry-3.141 Yes I think so.

        Excluding all rooms but ‘Kitchen’,

        Nested rooms "Living rioom, Kitchen’ - shows nothing
        Nested rooms "Kitchen, Living room’ shows info

        S 1 Reply Last reply Aug 31, 2016, 6:43 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @dinkybluebug245
          last edited by strawberry 3.141 Aug 31, 2016, 6:47 PM Aug 31, 2016, 6:43 PM

          @dinkybluebug245 can you give this a try?

          $.each(data, (i, item) => {
              if(this.config.exclude.indexOf(item.coordinator.roomName) === -1 || item.members.length > 1){
                  var room = item.coordinator.roomName;
                  var state = item.coordinator.state.zoneState;
                  var artist = item.coordinator.state.currentTrack.artist;
                  var track = item.coordinator.state.currentTrack.title;
                  var cover = item.coordinator.state.currentTrack.absoluteAlbumArtURI;
                  var streamInfo = item.coordinator.state.currentTrack.streamInfo;
                  if(item.members.length > 1){
                      room = '';
                      $.each(item.members, (j, member) => {
                          if(this.config.exclude.indexOf(member.roomName) === -1){
                              room += member.roomName + ', ';
                          }
                      });
                      room = room.slice(0, -2);
                  }
                  text += this.renderRoom(state, artist, track, cover, room);
              }
          }.bind(this));
          

          Please create a github issue if you need help, so I can keep track

          D 1 Reply Last reply Aug 31, 2016, 6:44 PM Reply Quote 0
          • D Offline
            dinkybluebug245 @strawberry 3.141
            last edited by Aug 31, 2016, 6:44 PM

            @strawberry-3.141 shouldnt the first line have ‘function’ in it?

            	$.each(data, function (i, item) {
            
            S 1 Reply Last reply Aug 31, 2016, 6:46 PM Reply Quote 0
            • S Offline
              strawberry 3.141 Project Sponsor Module Developer @dinkybluebug245
              last edited by strawberry 3.141 Aug 31, 2016, 6:46 PM Aug 31, 2016, 6:46 PM

              @dinkybluebug245 then you will change the scope of this, that’s why I prefer to use big arrow functions () => {} is the same as function(){} but you keep the scope

              Please create a github issue if you need help, so I can keep track

              D 2 Replies Last reply Aug 31, 2016, 6:47 PM Reply Quote 0
              • D Offline
                dinkybluebug245 @strawberry 3.141
                last edited by Aug 31, 2016, 6:47 PM

                @strawberry-3.141 I love how you think I know what that means. Ha! I’ll take your word on that and give it a go

                1 Reply Last reply Reply Quote 0
                • S Offline
                  strawberry 3.141 Project Sponsor Module Developer
                  last edited by strawberry 3.141 Aug 31, 2016, 6:51 PM Aug 31, 2016, 6:50 PM

                  a lot of people are doing this by saving the scope into a variable like

                  var self = this;
                  setTimeout(function(){
                          doSomething();
                          self.sendSocketNotification('NOTIFICATION');
                  }, 1000);
                  

                  but I like this cleaner way

                  setTimeout(() => {
                          doSomething();
                          this.sendSocketNotification('NOTIFICATION');
                  }, 1000);
                  

                  Please create a github issue if you need help, so I can keep track

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    dinkybluebug245 @strawberry 3.141
                    last edited by Aug 31, 2016, 6:52 PM

                    @strawberry-3.141 That doesnt work. Kitchen is the only room NOT excluded in my config.js

                    Kitchen, then group in Living room - shows info.

                    Living room, then grouping in Kitchen - doesnt show.

                    S 1 Reply Last reply Aug 31, 2016, 6:54 PM Reply Quote 0
                    • S Offline
                      strawberry 3.141 Project Sponsor Module Developer @dinkybluebug245
                      last edited by Aug 31, 2016, 6:54 PM

                      @dinkybluebug245 sry then you have to figure it out on your own or ask some person with sonos speakers for help

                      Please create a github issue if you need help, so I can keep track

                      D 1 Reply Last reply Aug 31, 2016, 6:59 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      2 / 3
                      • First post
                        12/23
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy