Giter VIP home page Giter VIP logo

mmm-sonos's Introduction

code climate API All Contributors License

MagicMirror-Sonos-Module

This is an adaption of the MagicMirror-SonosModule by Vaggan. It was modified to fit the new module system and got some enhancements in visualisation an configuration.

Sonos Module

Usage

Prerequisites:

Installation

Navigate into your MagicMirror's modules folder:

cd ~/MagicMirror/modules

Clone this repository:

git clone https://github.com/CFenner/MMM-Sonos

Navigate to the new MMM-Sonos folder and install the node dependencies.

cd MMM-Sonos/ && npm install --production

Configure the module in your config.js file.

Configuration

To run the module properly, you need to add the following data to your config.js file.

{
  module: 'MMM-Sonos',
  position: 'top_right', // you may choose any location
  config: {}
}

You also can set some options to hide different parts of the module.

Option Description Default
showStoppedRoom Trigger the visualization of stopped rooms. true
showAlbumArt Trigger the visualization of the album art. true
albumArtLocation Specifies on which side of the text the album art is rendered. Possible values: left, right. right
showRoomName Trigger the visualization of the room name. true

Known Issues

The module may not be able to access the data of the sonos API due to a Cross-Origin Resource Sharing (CORS) issue. This could be solved by adding the following lines to the sonos-http-api.js just before res.write(new Buffer(jsonResponse)); in the sonos api. Remember to restart the service after the change.

  res.setHeader("Access-Control-Allow-Origin", "http://localhost");
  res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

How to Install Sonos-API

To install the Sonos-API just clone the repository to your PI.

git clone https://github.com/jishi/node-sonos-http-api.git

Navigate to the new node-sonos-http-api folder and install the node dependencies.

cd node-sonos-http-api && npm install --production

Now you can run the service with:

npm start

I really recommend to use PM2 like it is described on the MagicMirror Wiki page.

cd ~/Sonos
npm start

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Christopher Edling
Christopher Edling

🤔 💻 🔬
Magnus
Magnus

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

mmm-sonos's People

Contributors

allcontributors[bot] avatar cfenner avatar dependabot[bot] avatar magmar94 avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmm-sonos's Issues

Playbar TV output

One of my Sonos units is a Playbar; when it is in 'TV mode', playing the audio from the TV it displays on the MM as a playing unit with just a square dot in place of the album art. (showStoppedRoom is set to false)

Can this be suppressed?

Music doesn't display on RPI1

Hi,
I'm using a RPI2 with MM2 as server only
I'm using a RPI1 to display MM2 screen, but Sonos module does not display any data on it, only Loading Music while IT is displayed correctly on a browser (on a Windows)
Any idea ?

Clearify installation of node-sonos-http-api

Hi, could you please clearify the installation of the module and the sonos http api?

The following I tried:

cd ~
cd MagicMirror/
cd node_modules/
wget https://github.com/jishi/node-sonos-http-api/archive/master.zip
unzip master.zip
npm install --production
npm start

(?) How to autostart the sonos api?
(?) My MagicMirror wont show up the Sonos Module. The screen keeps blank.

Neverending "Loading music ..." on MM²

Sonos API installed and started (works fine):
sonos

Made config entry:
sonosconfig

sonos folder in modules (no subfolder). But:
sonosload

Console:
console

Edit: I also checked the KnownIssue and restart the service / raspi.

Stuck at loading

Hi

Tried installing this but looks like I am doing something wrong. My skills when it comes to this is very limited so not sure where to start to fix it or even describe what is going wrong.

Installed the module like I installed many before. Configured it like this:

{
module: 'MMM-Sonos',
position: 'bottom_center', // you may choose any location
header: 'Now playing',
config: {
apiBase: '//192.168.126.111' //added this after looking at the other issues, did not help
}
},

Added the extra lines under known issues.

Installed sonos-api according to instructions and started it. Only thing I can see when I start it is this error:

INFO Could not find file /home/pi/node-sonos-http-api/settings.json

I have a settings.js file but not setting.json as far as I see.

On my mirror it just sais Loading music

Cant access localhost:5005 (even if I try it with replacing localhost with pi ip)

Any idea where I can start to look for errors?

Appreciate the help. Thanks

Music control ?

Your module works great, any chance to get music control on it ? Would be nice to interact with it (next song, volume etccc).

My MM will be touch screen (i hope) so i was wondering if in your plans to add this feature ?

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json
Error type: Invalid JSON (parsing failed)
Message: Syntax error: expecting end of expression or separator near ]
"pack

Sonos http api on another server...

Hi, I'm running the sonos http api on another server "10.0.0.21" (used for other stuff as well).
But when I point to that server (apiBase: '10.0.0.21')

I get this in the console (on every update)...
SONOS_UPDATE
Failure: Error: Invalid protocol: 10.0.0.21:

Is the plugin not compatible anymore?

Best regards Snille

Problem : module stuck on "Loading music"

Hello,
First of all, I apologise to post one more issue about the module MMM-Sonos being stuck on "Loading music".
I've read and tried to apply all the tips already provided in the "Issues list" but I cannot get my module to link to my Sonos devices.
I know it's a very old topic, but I hope someone will be willing to help, and that could maybe clarify for others in the same situation...

Sorry also for my poor knowledge about coding on raspberry, I will try to be as explicit as I can be.

  • First of all, I'm running a Raspberry PI OS on my Raspberry 3b+
  • I've checked on my network my Sonos IP (on the Sonos app for exemple), and it seems to be the one of my Sonos Beam, which of me is : 192.168.1.26
  • I've did the installation steps like this :

On the MagicMirror/config > config.js file i've even try to force the IP reading like this :
image

My MMM-Sonos.js look like this :
image
and this :
image

I can see that my http-api PM2 seems to be well working when the raspberry starts :
Capture d’écran 2021-01-25 180349

If someone can support it would be greatly appreciated.

Take care during this weird period.

Léo

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm eslint-plugin-node Available
npm request Unavailable

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/validation.yml
  • actions/checkout v4
  • nosborn/github-action-markdown-cli v3.3.0
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • request 2.88.2
  • eslint 8.57.0
  • eslint-config-standard 17.1.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-node 11.1.0
  • eslint-plugin-promise 6.1.1
  • less 4.2.0
  • stylelint 16.2.1
  • stylelint-config-standard 36.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Album art not showing

Everything else works, but I'm seeing only a generic icon where the album art should be. Except during commercial, then the graphic appears. Has anyone seen this?

formatting while playing Sirius radio

the formatting while playing Sirius radio adds a lot of text such as

BR TYPE=SNG|TITLE
|ARTIST
|ALBUM

This results in the module growing and taking over the entire with of my mirror.

Default "Track:" label not changing when preTrackText added with alternate content

All other pre entries seem to work except track.

config.sys

/*************** AUTO GENERATED BY REMOTE CONTROL MODULE ***************/

var config = 
{
                ...
		{
			module: "MMM-Sonos",
			position: "bottom_left",
			header: "Now Playing",
			config: {
				preRoomText: "",
				preArtistText: "",
				preTypeText: "",
				preTrackText: "",
				showStoppedRoom: "",
				exclude: [
					
				],
				showRoomName: false
			}
		},
	],
	paths: {
		modules: "modules",
		vendor: "vendor"
	}
}

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = config;}

screen shot 2018-03-07 at 11 27 05

playbar still shows when playbar is in TV mode - also how do I hide some rooms?

Hi - great module by the way

My playbar is still showing when in TV mode, which is weird as I thought the name of the room would be hidden if the TV was on. Any ideas why?

Also - I only want to show information for one room - in this case the 'kitchen'. Is there anyway to only show Kitchen sonos information?

See picture for example - ignore 'people magazine' text - https://postimg.org/image/f6hthcgjz/

Many thanks

/zones info is :

[{"uuid":"RINCON_000E58C229A401400","coordinator":{"uuid":"RINCON_000E58C229A401400","state":{"currentTrack":{"artist":"","title":"BBC Radio 2","album":"","albumArtURI":"/getaa?s=1&u=x-sonosapi-stream%3as24940%3fsid%3d254%26flags%3d8224%26sn%3d0","duration":0,"uri":"x-sonosapi-stream:s24940?sid=254&flags=8224&sn=0","radioShowMetaData":"Pick of the Pops,p49588","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?s=1&u=x-sonosapi-stream%3as24940%3fsid%3d254%26flags%3d8224%26sn%3d0","streamInfo":"","type":"radio"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":26,"mute":false,"trackNo":1,"elapsedTime":0,"elapsedTimeFormatted":"00:00","zoneState":"STOPPED","playerState":"STOPPED","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Bedroom","coordinator":"RINCON_000E58C229A401400","groupState":{"volume":26,"mute":false}},"members":[{"uuid":"RINCON_000E58C229A401400","state":{"currentTrack":{"artist":"","title":"BBC Radio 2","album":"","albumArtURI":"/getaa?s=1&u=x-sonosapi-stream%3as24940%3fsid%3d254%26flags%3d8224%26sn%3d0","duration":0,"uri":"x-sonosapi-stream:s24940?sid=254&flags=8224&sn=0","radioShowMetaData":"Pick of the Pops,p49588","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?s=1&u=x-sonosapi-stream%3as24940%3fsid%3d254%26flags%3d8224%26sn%3d0","streamInfo":"","type":"radio"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":26,"mute":false,"trackNo":1,"elapsedTime":0,"elapsedTimeFormatted":"00:00","zoneState":"STOPPED","playerState":"STOPPED","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Bedroom","coordinator":"RINCON_000E58C229A401400","groupState":{"volume":26,"mute":false}}]},{"uuid":"RINCON_B8E9375058C601400","coordinator":{"uuid":"RINCON_B8E9375058C601400","state":{"currentTrack":{"artist":"Adele","title":"Daydreamer","album":"19","albumArtURI":"/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f01%2520Daydreamer.mp3&v=46","duration":220,"uri":"x-file-cifs://wdmycloud/public/Shared%20Music/Adele/19/01%20Daydreamer.mp3","radioShowMetaData":"","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f01%2520Daydreamer.mp3&v=46","streamInfo":"","type":"track"},"nextTrack":{"uri":"x-file-cifs://wdmycloud/public/Shared%20Music/Adele/19/02%20Best%20for%20Last.mp3","albumArtURI":"/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f02%2520Best%2520for%2520Last.mp3&v=46","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f02%2520Best%2520for%2520Last.mp3&v=46","title":"Best for Last","artist":"Adele","album":"19"},"volume":25,"mute":false,"trackNo":1,"elapsedTime":25,"elapsedTimeFormatted":"00:25","zoneState":"PAUSED_PLAYBACK","playerState":"PAUSED_PLAYBACK","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Bathroom","coordinator":"RINCON_B8E9375058C601400","groupState":{"volume":25,"mute":false}},"members":[{"uuid":"RINCON_B8E9375058C601400","state":{"currentTrack":{"artist":"Adele","title":"Daydreamer","album":"19","albumArtURI":"/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f01%2520Daydreamer.mp3&v=46","duration":220,"uri":"x-file-cifs://wdmycloud/public/Shared%20Music/Adele/19/01%20Daydreamer.mp3","radioShowMetaData":"","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f01%2520Daydreamer.mp3&v=46","streamInfo":"","type":"track"},"nextTrack":{"uri":"x-file-cifs://wdmycloud/public/Shared%20Music/Adele/19/02%20Best%20for%20Last.mp3","albumArtURI":"/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f02%2520Best%2520for%2520Last.mp3&v=46","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?u=x-file-cifs%3a%2f%2fwdmycloud%2fpublic%2fShared%2520Music%2fAdele%2f19%2f02%2520Best%2520for%2520Last.mp3&v=46","title":"Best for Last","artist":"Adele","album":"19"},"volume":25,"mute":false,"trackNo":1,"elapsedTime":25,"elapsedTimeFormatted":"00:25","zoneState":"PAUSED_PLAYBACK","playerState":"PAUSED_PLAYBACK","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Bathroom","coordinator":"RINCON_B8E9375058C601400","groupState":{"volume":25,"mute":false}}]},{"uuid":"RINCON_000E58B9149B01400","coordinator":{"uuid":"RINCON_000E58B9149B01400","state":{"currentTrack":{"artist":"","title":" ","album":"","albumArtURI":"","duration":0,"uri":"x-sonos-htastream:RINCON_000E58B9149B01400:spdif","radioShowMetaData":"","absoluteAlbumArtURI":"","type":"track"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":21,"mute":false,"trackNo":1,"elapsedTime":38,"elapsedTimeFormatted":"00:38","zoneState":"PLAYING","playerState":"PLAYING","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Living Room","coordinator":"RINCON_000E58B9149B01400","groupState":{"volume":21,"mute":false}},"members":[{"uuid":"RINCON_000E58B9149B01400","state":{"currentTrack":{"artist":"","title":" ","album":"","albumArtURI":"","duration":0,"uri":"x-sonos-htastream:RINCON_000E58B9149B01400:spdif","radioShowMetaData":"","absoluteAlbumArtURI":"","type":"track"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":21,"mute":false,"trackNo":1,"elapsedTime":38,"elapsedTimeFormatted":"00:38","zoneState":"PLAYING","playerState":"PLAYING","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Living Room","coordinator":"RINCON_000E58B9149B01400","groupState":{"volume":21,"mute":false}}]},{"uuid":"RINCON_B8E93721CD5201400","coordinator":{"uuid":"RINCON_B8E93721CD5201400","state":{"currentTrack":{"artist":"","title":"Capital London","album":"","albumArtURI":"/getaa?s=1&u=x-sonosapi-stream%3as16534%3fsid%3d254%26flags%3d32%26sn%3d0","duration":0,"uri":"x-sonosapi-stream:s16534?sid=254&flags=32&sn=0","radioShowMetaData":"Will Cozens,p283635","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?s=1&u=x-sonosapi-stream%3as16534%3fsid%3d254%26flags%3d32%26sn%3d0","streamInfo":"","type":"radio"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":37,"mute":false,"trackNo":1,"elapsedTime":0,"elapsedTimeFormatted":"00:00","zoneState":"STOPPED","playerState":"STOPPED","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Kitchen","coordinator":"RINCON_B8E93721CD5201400","groupState":{"volume":37,"mute":false}},"members":[{"uuid":"RINCON_B8E93721CD5201400","state":{"currentTrack":{"artist":"","title":"Capital London","album":"","albumArtURI":"/getaa?s=1&u=x-sonosapi-stream%3as16534%3fsid%3d254%26flags%3d32%26sn%3d0","duration":0,"uri":"x-sonosapi-stream:s16534?sid=254&flags=32&sn=0","radioShowMetaData":"Will Cozens,p283635","absoluteAlbumArtURI":"http://192.168.1.13:1400/getaa?s=1&u=x-sonosapi-stream%3as16534%3fsid%3d254%26flags%3d32%26sn%3d0","streamInfo":"","type":"radio"},"nextTrack":{"artist":"","title":"","album":"","albumArtURI":"","duration":0,"uri":""},"volume":37,"mute":false,"trackNo":1,"elapsedTime":0,"elapsedTimeFormatted":"00:00","zoneState":"STOPPED","playerState":"STOPPED","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}},"playMode":{"shuffle":false,"repeat":false,"crossfade":false},"roomName":"Kitchen","coordinator":"RINCON_B8E93721CD5201400","groupState":{"volume":37,"mute":false}}]}]

Many thanks

MagicMirror goes to blank (dark)

I have installed the "node-sonos-http-api" in "/MagicMirror/modules/node-sonos-http-api" and it is working.
I can access the localhost:5005 without any problems.

The "MagicMirror-Sonos-Module" is installed in "/MagicMirror/modules/MagicMirror-Sonos-Module"

I have added;
{
module: 'MagicMirror-Sonos-Module',
position: 'bottom_bar', // you may choose any location
config: {}
}
to config.js

If I comment out these rows MagicMirror starts without problem.
I run MagicMirror in "serveronly" mode.

What have I missed?

Loading music... local browser

Hi,

when I open the mirror url on a different machine I get the Sonos Infos, but when I look at the hdmi connected one to my raspberry it just stays Loading music... and doesnt change.

I am using a Pi B+ with Epiphany in Kiosk mode.

Any help would be apreciated.

I just found this error I am getting:
Message: console message: http://localhost:8080/modules/sonos//sonos.js @101: TypeError: undefined is not a function (evaluating 'this.data.position.endsWith("left")')

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.