Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring Zones #54

Closed
proffalken opened this issue May 4, 2016 · 6 comments
Closed

Configuring Zones #54

proffalken opened this issue May 4, 2016 · 6 comments

Comments

@proffalken
Copy link

Hi,

Firstly, thanks for an awesome system, I'm in the process of configuring it to link in to OpenHAB via Mopidy and it's looking promising!

I'm interested in knowing how to configure "zones", allowing me to move music throughout the house or allow my kids to play one song in one room and a different one somewhere else (I've got three girls, it's going to happen sooner or later!)

The README.md suggests that Zones are "complete", however, I can't find any documentation on how to configure them and the code on the "master" branch doesn't say anything when run with "-h" for either the client or the server.

Thanks in advance for any help you can give,

Matt

@badaix
Copy link
Owner

badaix commented May 4, 2016

Hi,

it's roughly described in the configuration part of the Readme:

Different streams can by configured with a list of -s options, e.g.:
SNAPSERVER_OPTS="-d -s pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac -s file:///home/user/Musik/Some%20wave%20file.wav?name=File"

You can configure e.g. three different pipe streams:
SNAPSERVER_OPTS="-d -s pipe:///tmp/snapfifo1?name=Name1 -s pipe:///tmp/snapfifo2?name=Name2 -s pipe:///tmp/snapfifo3?name=Girl%203"

This will create three different zones. You need the Android client to assign a client to a zone. You now can run three different mopidy instances, each feeding the audio into a different pipe.

@proffalken
Copy link
Author

Thanks for such a quick response!

Just to confirm, I can configure the server to stream multiple feeds at the same time, however it's the Android client that designates the "zones" that these streams relate to, not the server or client config?

Does that mean that I have to have the android client running at all times, or do the clients "remember" which zones they are in?

Thanks again,

Matt

P.S. When I get this working, I'll do a full write-up :)

@badaix
Copy link
Owner

badaix commented May 4, 2016

Actually the server does the "routing". He knows about all connected clients and streams and which client should receive what stream.
When a client is connected the first time, it will be assigned to the first stream. The server stores the configuration in one of these files: /var/lib/snapcast/server.json or $HOME/.config/snapcast/server.json
The configuration (assignment of client to stream) can be changed using the Android client (see screenshot in the readme) via the JSON-RPC interface (see also #53).

@proffalken
Copy link
Author

Got it working!

I'll do a full write up and release the Ansible roles in the next few days.

The trick is to configure multiple instances of mopidy (harder than it sounds, the init-scripts really aren't designed to do this!) and then cycle over the mopidy instances configuring the various streams.

The snapclients then all show up in the mobile app and you can allocate them to rooms.

The only issue I have is that all of my nodes are called "raspberrypi" at the moment, so if there's a way to set the client name and the stream it should be attached to without the App, that would be great! (I'm assuming I can post some JSON-RPC to the server to do this on client startup, I just can't work out the syntax to do it at the moment!)

@badaix
Copy link
Owner

badaix commented May 5, 2016

Renaming can be done in the app. Just press the three dots on the right of a client, choose "details" and click on "name" to change it.
This should also by possible with python-snapcast (Issue #29).

@proffalken
Copy link
Author

Brilliant, thank you.

I'll close this now. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants