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 15.6k 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

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

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

        @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 Reply Quote 0
        • D Offline
          dinkybluebug245 @strawberry 3.141
          last edited by

          @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
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer
            last edited by strawberry 3.141

            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

              @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.

              strawberry 3.141S 1 Reply Last reply Reply Quote 0
              • strawberry 3.141S Offline
                strawberry 3.141 Project Sponsor Module Developer @dinkybluebug245
                last edited by

                @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 Reply Quote 0
                • D Offline
                  dinkybluebug245 @strawberry 3.141
                  last edited by dinkybluebug245

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    dinkybluebug245
                    last edited by

                    Ive had a go at trying to fix this myself and cant work it out - but then again my own knowledge of js is non existant. It works when rooms are isolated on their own, or when the speaker you want to display is listed first in a group of grouped speakers - the solutions above dont work when the speaker is not listed first in the group.

                    Can anyone else help?

                    Thanks again to @strawberry-3-141 for having a stab at this.

                    1 Reply Last reply Reply Quote 0
                    • SnilleS Offline
                      Snille Module Developer
                      last edited by

                      Hi all,
                      I don’t know if this is the right place, but here it goes.
                      I forked and made some changes to the Sonos module.
                      Can be found here: https://github.com/Snille/MMM-Sonos
                      Let me know is I should present it in some other thread. :)

                      Best regards Snille

                      If you cant find it, make it and share it!
                      Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      • First post
                        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