Skip to content

Installation

Henrik Tilly edited this page Oct 19, 2016 · 6 revisions

Installation

In order to get the bot up and running you need to do the following.

##Pre-requisit:

1: #Slack-group with admin rights

2: A server / machine that can run node.js

3: A working Sonos player configured with Spotify

3a: You need to know the IP of your Sonos player.

#Slack

Create a bot in #Slack.

You need to give it a name, and write down the API Token. You will need this in your setting file later.

Hit "Save Integration" and you are done in #Slack.

Optional you can give the bot some nice namne, icon etc.

For an icon, have a look in zenmusic/doc/images/ZenMusic.png

Node.js - Zenmusic!

This guide assume you have git, node.js and NPM installed, and running linux =)

Change to "/opt"

cd /opt

Clone this repository

git clone https://github.com/htilly/zenmusic.git

Enter the new directory, zenmusic

cd zenmusic

Type

npm install

Almost there... some simple configuration first.

config.json

Copy the example config to your own config file.

cp config.json.example config.json

Edit config.json with your favorit text editor.

Replace:

"music-admin" - with the #slack channel you want the bot to respond to admin commands.`

"music" - with the #slack channel you want the bot to be a DJ in =)`

"IP_TO_SONOS" - with the (static) IP of you sonos player / controller.`

"SLACK:TOKEN" - with the token you got for the bot in "Slack.`

"US" - with the country that you use Spotify.

75 - with the maximum volume you can set the Sonos to via "setvolume" in #Slack

And last thing... start the bot!

node index.js

You should see something like:

[Sat Apr 30 2016 21:44:10 GMT+0200 (CEST)] INFO Connecting... Welcome to Slack. You are @zenmusicbot of Schibsted Media Group You are in: #music As well as: music-admin

##Known Issues:

If you for any reason get the following 500 error in the logs:

Error: HTTP response code 500 for "urn:schemas-upnp-org:service:AVTransport:1#AddURIToQueue"

Please try to change the following code in index.js. You need to change this in three places.

Don´t know what this is happening, but it has been confirmed on at least two systems :/

// Old version.. New is supposed to fix 500 problem...

// sonos.addSpotifyQueue(spid, function (err, res) {

sonos.addSpotify(spid, function (err, res) {

Clone this wiki locally