Skip to content

PuppetmasterDK/stonebite

Repository files navigation

StoneBite

Build Status Coverage Status

This simple service wraps the BlueSound players with a small web API. It automatically detects the players on the network

It have some convenience methods to ensure that pressing play does not give a break in the sound even when playing from streaming services.

The endpoints are based on the API discussion here: https://helpdesk.bluesound.com/discussions/viewtopic.php?t=2293. And some more digging into network traffic

A prebuilt docker image can also be found here: https://hub.docker.com/r/puppetmasterdk/stonebite/

Further API Endpoints

Playlists with all playlists:

http://192.168.0.103:11000/Playlists?imported=1

Play playlist (aka add it to the current playlist, but clear the existing and start by the first song):

http://192.168.0.103:11000/Add?service=LocalMusic&playnow=1&playlistid=Musik+til+reception&clear=1&listindex=0&playlist=Musik+til+reception

Play artist:

URL	http://192.168.0.103:11000/Add?service=LocalMusic&playnow=1&where=last&all=1&listindex=0&nextlist=1&cursor=last&artist=Adele

Sleep (Call multiple times to set sleep):

http://192.168.0.130:11000/Sleep

Configuration

The configuration file contains a timeout in seconds

bluesound = {
  timeout = 5
}
play.http.secret.key=${?APPLICATION_SECRET}

Which means you need to specify an application secret (These can be generated by running sbt playGenerateSecret)

The players are found using the mDNS group.

Running

Just run the Play app:

sbt run

Then navigate to: http://localhost:9000 this will redirect you to the documentation of the endpoints

Running the tests:

To run the tests with no coverage information collected:

sbt test

Run with coverage:

sbt clean coverage test coverageReport

Building a Docker Image

First generate a new application secret:

sbt playGenerateSecret

Save the generate secret so you can insert it later.

Now create the docker image:

sbt dist docker:publishLocal

You can now run the service using docker:

docker run --name stonebite -p 8080:9000 -e "APPLICATION_SECRET=<INSERT APPLICATION SECRET!>" stonebite:1.0-SNAPSHOT

This will start it and expose port 8080. So go to your webbrowser and open: http://localhost:8080

Example:

curl -X GET "http://localhost:9000/bluesound/alrum/play" -H "accept: application/json"

To Do

  • CRUD for workflows
  • Can it be used for a Doorbell?
  • Consider mapping from switch ID to room
  • Setup Guice with modules

License

This project is using the MIT License. See LICENSE.

This project is not affiliated with BlueSound or NAD in any way.

About

A simple wrapper for the BlueSound Players

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published