Coder Social home page Coder Social logo

mmm-sonos's Introduction

MagicMirror Module: Sonos

MMM-Sonos is a module for MagicMirror that allows you to display playing tracks on your Sonos network. It support the display of different rooms and track information.

Screenshot of the Sonos module

Usage

Setup

Clone this module into your MagicMirror's modules directory and install dependencies:

cd modules
git clone https://github.com/tbouron/MMM-Sonos
cd MMM-Sonos
npm i

then add the module to your MagicMirror's configuration. Here is an example:

/* MagicMirror/config/config.js */
{
    /* ...your other config here */

    modules: [

        /* ...your other modules here */

        {
            module: 'MMM-Sonos',
            header: 'Now playing',
            position: 'top_left',
            config: {
                animationSpeed: Number,
                showFullGroupName: Boolean,
                showArtist: Boolean,
                showAlbum: Boolean,
                showMetadata: Boolean
            }
        }
    ]
}

Configuration options

Configuration key Description Default Required
animationSpeed Animation speed to display/hide the module when tracks change. This value is in milliseconds 1000 No
showFullGroupName Whether or not to display all devices in the group. If false, the group name will be <coordinator-name> +<number-other-devices>, e.g. Kitchen +2. false No
showArtist Whether or not to display the artist name true No
showAlbum Whether or not to display the album name true No
showMetadata Whether or not to display the track metadata, i.e. room where it's played, length, volume true No

mmm-sonos's People

Contributors

kristjanesperanto avatar tbouron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mmm-sonos's Issues

Scrolling

Love this module! super clean and works perfectly. Not so much of an issue but more of a request. Complete noob to java and coding in general but learning as I go. Is it possible to add a scrolling feature for the track title, artist, album, etc?

Won’t start MM

Hey there,

I wanted to put this module in my Mirror, but I when I put the code into config.js, moved it to a different part of the screen, and saved, it was like it disabled the auto-start I had on it, and I couldn’t start anything with npm run start. As soon as I deleted the module from config.js, it worked fine. Can someone please help?

Error: Cannot find module 'sonos'

[23:39:56.742] [ERROR] Error: Cannot find module 'sonos'
at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
at Function.Module._load (internal/modules/cjs/loader.js:528:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/pi/MagicMirror/modules/MMM-Sonos/node_helper.js:2:59)
at Object. (/home/pi/MagicMirror/modules/MMM-Sonos/node_helper.js:141:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
[23:39:56.743] [LOG] Whoops! There was an uncaught exception...
[23:39:56.744] [ERROR] { Error: Cannot find module 'sonos'
at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
at Function.Module._load (internal/modules/cjs/loader.js:528:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/pi/MagicMirror/modules/MMM-Sonos/node_helper.js:2:59)
at Object. (/home/pi/MagicMirror/modules/MMM-Sonos/node_helper.js:141:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10) code: 'MODULE_NOT_FOUND' }

Font size

Hello,

Is there a way to change the size of the font of the album's name ?

Thanks

Yann

UnhandledPromiseRejectionWarning Error 405 Method Not Allowed

Hello

I have been unable to make this module work and I think I have narrowed it down to a Sonos Boost in my system
Every time the boost is plugged in I get the following errors and the module displays nothing

0|mm  | [10.06.2021 18:56.52.463] [ERROR]
0|mm  | (node:31409) UnhandledPromiseRejectionWarning: Error: upnp: Request failed with status code 405///<HTML><HEAD><TITLE>Error 405</TITLE></HEAD><BODY><H1>Error 405</H1><P>Method Not Allowed</P></BODY></HTML>
0|mm  |     at /home/pi/MagicMirror/modules/MMM-Sonos/node_modules/sonos/lib/services/Service.js:90:25
0|mm  |     at runMicrotasks (<anonymous>)
0|mm  |     at processTicksAndRejections (internal/process/task_queues.js:97:5)
0|mm  | [10.06.2021 18:56.52.464] [ERROR] (node:31409) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9
)

My take is that an unrecognised command is sent to the boost and the error is not properly handled/ignored
This is the boost device object in my system, nothing seems to distinguish it from the speaker devices

Sonos {
  host: '192.168.1.162',
  port: 1400,
  options: {
    endpoints: {
      transport: '/MediaRenderer/AVTransport/Control',
      rendering: '/MediaRenderer/RenderingControl/Control',
      device: '/DeviceProperties/Control'
    },
    spotify: { region: '3079' }
  },
  _events: [Object: null prototype] {
    newListener: [AsyncFunction: implicitListen]
  },
  _eventsCount: 1
}

I will try to trace it down to the actual error but documenting here what I have found thus far

No text on the screen

I have an issue that I don't see any "Sonos" info on the screen. The standard modules works OK. I can se in the log Windwos that my Pi have contact with my Sonos system.
Any idea?
Best Regards Toni

Track Number

Hi,
is it possible to add the track number in front of the track. On which api or whatever is the module running. From what does ist get the data?

Module not loading

The module is not loading on the MM.
Are there any dependancies, like an API or whatever?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.