MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

MMM-Sonos - Display what is currently playing on your Sonos network


  • Module Developer

    Hi there.

    I realised there is already a couple of modules for Sonos, but they didn’t really worked for me. I wanted something more minimalist, and easier to install: all sonos modules right now require to install and run a proxy sonos API server along side MagicMirror. My module doesn’t: clone it, install it and there you go!

    All necessary information (configuration, screenshot) is available on the GitHub repository: https://github.com/tbouron/MMM-Sonos

    Hope you’ll enjoy!

    0_1577188815998_screenshot.png



  • Hi @tbouron,
    Great idea to simplify SONOS integration installation!
    Your module works for me, and I like that it updates the data almost instantly comparing to other modules that do it on schedule.
    But in my case your module constantly thinks that something have updated in SONOS groups, even if nothing is currently being played. So it constantly updates the groups, sets listener, causing high CPU utilization by Electron.


  • Module Developer

    Hi @eliah, thanks for your comment!
    The module looking for groups regularly is by design: there is unfortunately no event when groups changes therefore they are pulled every 5 seconds. The listeners are set only when groups have changed.

    I checked on my mirror and cannot see a difference of CPU usage with or without the module enabled. How “bad” is the CPU hog on yours?



  • @tbouron,
    In my case it seems that the script always consider that groups have changed, but that’s not true in fact. The log is full of repeating lines like that:

    [14:18:03.026] [LOG]    Found new (or updated) group "Kitchen + 1" on host "x.x.x.34"
    [14:18:03.029] [LOG]    Registering listeners on group "Kitchen + 1" (host "x.x.x.34")
    [14:18:03.281] [LOG]    [Group Kitchen + 1 - x.x.x.34] Track changed to "Pokerface" by "The Baseballs"
    [14:18:03.289] [LOG]    [Group Kitchen + 1 - x.x.x.34] Play state change to "paused"
    [14:18:03.353] [LOG]    [Group Kitchen + 1 - x.x.x.34] Volume changed to "13"
    [14:18:03.361] [LOG]    [Group Kitchen + 1 - x.x.x.34] Group is unmuted
    [14:18:07.847] [LOG]    Found new (or updated) group "Bathroom" on host "x.x.x.39"
    [14:18:07.849] [LOG]    Registering listeners on group "Bathroom" (host "x.x.x.39")
    [14:18:07.852] [LOG]    Found new (or updated) group "Kids’ Room" on host "x.x.x.40"
    [14:18:07.854] [LOG]    Registering listeners on group "Kids’ Room" (host "x.x.x.40")
    [14:18:08.045] [LOG]    [Group Kids’ Room - x.x.x.40] Track changed to "Durch den Monsun" by "Annett Louisan"
    [14:18:08.053] [LOG]    [Group Kids’ Room - x.x.x.40] Play state change to "paused"
    [14:18:08.081] [LOG]    [Group Bathroom - x.x.x.39] Track changed to "Umbrella" by "The Baseballs"
    [14:18:08.088] [LOG]    [Group Bathroom - x.x.x.39] Play state change to "paused"
    [14:18:08.157] [LOG]    [Group Kids’ Room - x.x.x.40] Volume changed to "22"
    [14:18:08.163] [LOG]    [Group Kids’ Room - x.x.x.40] Group is unmuted
    [14:18:08.213] [LOG]    [Group Bathroom - x.x.x.39] Volume changed to "15"
    [14:18:08.216] [LOG]    [Group Bathroom - x.x.x.39] Group is unmuted
    [14:18:13.066] [LOG]    Found new (or updated) group "Kitchen + 1" on host "x.x.x.34"
    [14:18:13.069] [LOG]    Registering listeners on group "Kitchen + 1" (host "x.x.x.34")
    [14:18:13.507] [LOG]    [Group Kitchen + 1 - x.x.x.34] Track changed to "Pokerface" by "The Baseballs"
    [14:18:13.514] [LOG]    [Group Kitchen + 1 - x.x.x.34] Play state change to "paused"
    [14:18:13.593] [LOG]    [Group Kitchen + 1 - x.x.x.34] Volume changed to "13"
    [14:18:13.597] [LOG]    [Group Kitchen + 1 - x.x.x.34] Group is unmuted
    [14:18:18.029] [LOG]    Found new (or updated) group "Kids’ Room" on host "x.x.x.40"
    [14:18:18.032] [LOG]    Registering listeners on group "Kids’ Room" (host "x.x.x.40")
    [14:18:18.036] [LOG]    Found new (or updated) group "Bathroom" on host "x.x.x.39"
    [14:18:18.040] [LOG]    Registering listeners on group "Bathroom" (host "x.x.x.39")
    [14:18:18.277] [LOG]    [Group Kids’ Room - x.x.x.40] Track changed to "Durch den Monsun" by "Annett Louisan"
    [14:18:18.285] [LOG]    [Group Kids’ Room - x.x.x.40] Play state change to "paused"
    [14:18:18.309] [LOG]    [Group Bathroom - x.x.x.39] Track changed to "Umbrella" by "The Baseballs"
    [14:18:18.318] [LOG]    [Group Bathroom - x.x.x.39] Play state change to "paused"
    [14:18:18.408] [LOG]    [Group Kids’ Room - x.x.x.40] Volume changed to "22"
    [14:18:18.414] [LOG]    [Group Kids’ Room - x.x.x.40] Group is unmuted
    [14:18:18.434] [LOG]    [Group Bathroom - x.x.x.39] Volume changed to "15"
    [14:18:18.437] [LOG]    [Group Bathroom - x.x.x.39] Group is unmuted
    [14:18:23.059] [LOG]    Found new (or updated) group "Kitchen + 1" on host "x.x.x.34"
    [14:18:23.063] [LOG]    Registering listeners on group "Kitchen + 1" (host "x.x.x.34")
    [14:18:23.248] [LOG]    [Group Kitchen + 1 - x.x.x.34] Track changed to "Pokerface" by "The Baseballs"
    [14:18:23.255] [LOG]    [Group Kitchen + 1 - x.x.x.34] Play state change to "paused"
    [14:18:23.353] [LOG]    [Group Kitchen + 1 - x.x.x.34] Volume changed to "13"
    [14:18:23.359] [LOG]    [Group Kitchen + 1 - x.x.x.34] Group is unmuted
    [14:18:27.955] [LOG]    Found new (or updated) group "Kids’ Room" on host "x.x.x.40"
    [14:18:27.959] [LOG]    Registering listeners on group "Kids’ Room" (host "x.x.x.40")
    [14:18:27.965] [LOG]    Found new (or updated) group "Bathroom" on host "x.x.x.39"
    [14:18:27.969] [LOG]    Registering listeners on group "Bathroom" (host "x.x.x.39")
    [14:18:28.311] [LOG]    [Group Kids’ Room - x.x.x.40] Track changed to "Durch den Monsun" by "Annett Louisan"
    [14:18:28.316] [LOG]    [Group Kids’ Room - x.x.x.40] Play state change to "paused"
    [14:18:28.343] [LOG]    [Group Bathroom - x.x.x.39] Track changed to "Umbrella" by "The Baseballs"
    [14:18:28.351] [LOG]    [Group Bathroom - x.x.x.39] Play state change to "paused"
    [14:18:28.430] [LOG]    [Group Kids’ Room - x.x.x.40] Volume changed to "22"
    [14:18:28.434] [LOG]    [Group Kids’ Room - x.x.x.40] Group is unmuted
    [14:18:28.471] [LOG]    [Group Bathroom - x.x.x.39] Volume changed to "15"
    [14:18:28.474] [LOG]    [Group Bathroom - x.x.x.39] Group is unmuted
    
    

    And as I said before, actually all speakers are paused so nothing is really playing.


  • Module Developer

    @eliah That’s interesting, it would suggest that the group IDs are not consistent (as groups are cached by IDs) which obviously shouldn’t happen. I’m also wondering if targeting a random device on every scan has any implications on this (but it shouldn’t, at least I cannot reproduce this on my own network)

    Would it possible for you to test a different version? I would like to see how it can be mitigated.



  • sure, I can test if you have any ideas why it is happening.


  • Module Developer

    Hi @eliah. Can you try the version on the branch fix/group-scan and tell me how it goes ?

    You would just need to go into the MMM-Sonos folder and do:

    git fetch && git checkout fix/group-scan
    

    Thanks 🙂



  • @tbouron Beautiful module. How can I get the album art and Rooms that are stopped to also show up? What other info can I display?

    Thanks


  • Module Developer

    Hi @Jas and thanks!

    Both of these are not supported. The concept of the module was to have a Sonos now playing... module with minimalist design hence:

    • only vital information: title, artist, album (can be toggled), metadata: room, volume and track length (can be toggled)
    • no album artwork
    • show only rooms where music is playing, otherwise show nothing to avoid clutter

    It would not be too hard to do all the above, but I don’t plan to do it anytime soon because of the concept.



  • @tbouron Got it! Thank you for the quick response. Looks great!


Log in to reply