A tiny Node.js webserver to handle and forward RESTful calls for Roon's API. Uses Node.js and Express.js to accept HTTP GET requests and forward them over websocket to your Roon core, using Roon's API (introduced in 1.3).
- Roon 1.3 or newer
- Roon core running on a Raspberry Pi (or other Linux system, including macOS) or Windows
- Node.js and the NPM package manager (installation instructions below)
- Optional but highly recommended: the Workflow app for iOS
See usage instructions below.
-
Install Node.js from here: https://nodejs.com/
- On Windows, install from the above link.
- On macOS, install using Homebrew:
brew install node
(if you don't have Homebrew install from the link). - On Linux, you can use your distribution's package manager, but make sure it installs a recent version of Node.js. Otherwise, just install from the above link.
-
Check that you are running node 5.x or higher by typing:
node -v
-
On the machine that you want to run the server from (usually best to do so on your Roon core),
git clone
this repository into a suitable location (you may need to install Git if you haven't already, although installing Node.js requires Git). -
Look inside the package.json file inside the folder. You should see something like this:
{ "name": "roon-remote", "version": "1.0.0", "description": "Remote to control my Roon setup.", "main": "app.js", "dependencies": { "express": "^4.15.2", "node-roon-api": "github:roonlabs/node-roon-api", "node-roon-api-status": "github:roonlabs/node-roon-api-status", "node-roon-api-transport": "github:roonlabs/node-roon-api-transport" } }
This file tells Node.js what to install in the next step. You can change the name and description here, but the rest of the file should remain unchanged (unless in future you need to install new dependencies, in which case you should add to the dependencies list and run
npm install
again. For now, move on the step 3. -
Navigate to the folder in PowerShell or Git Bash (Windows), Terminal (macOS) or whatever Linux distro's bash terminal you're using. Type the following:
npm install
This will install the Express.js module and dependencies (needed for the webserver), as well as all of the Roon API's dependencies (according to your package.json file).
-
Next, test your server by typing:
node .
If all goes well, you should see some very verbose console output, which eventually begins to 'ping':
<- REQUEST 1 com.roonlabs.ping:1/ping -> COMPLETE 1 Success <- REQUEST 1 com.roonlabs.ping:1/ping -> COMPLETE 1 Success <- REQUEST 2 com.roonlabs.ping:1/ping -> COMPLETE 2 Success <- REQUEST 2 com.roonlabs.ping:1/ping -> COMPLETE 2 Success ...
If this happens, the API has successfully connected to your Roon core. If you encounter any error messages here, try starting the process again as root, verifying that your Roon core is up and accessible, and that you have at minimum Roon 1.3.
-
Finally, to allow the extension to communicate with your Roon core, go to Settings -> Extensions inside Roon and click Enable next to the extension. It should show a status of: 'Extension running...'.
-
To make a request, format your HTTP GET like this:
http://<server>:3000/api?command=<command>&zone=<zone_display_name>
Where <server> is your host's IP address, <command> is the control action to perform, which can be any of the following (from the Roon Transport API docs):
"play" - If paused or stopped, start playback "pause" - If playing or loading, pause playback "playpause" - If paused or stopped, start playback. If playing or loading, pause playback. "previous" - Go to the start of the current track, or to the previous track "next" - Advance to the next track
<zone> should be the zone's display name, URL encoded. For instance, Living Room becomes Living%20Room.
There are a number of ways to run a Node.js server as a service in Windows, macOS or Linux. I recommend using node-windows (which has sister variants for macOS and Linux, node-mac and node-linux respectively).
On an iOS device (how I use the extension), you can use the Workflow app for iOS to send HTTP GET requests. I recommend you set up Workflow like this:
- Download the Workflow app from the App Store.
- Click this link on the iOS device: https://workflow.is/workflows/7bf76714e84a4030a1af292fe40cf02b
- During the workflow import, enter the IP address of the device running the Node.js webserver and the port you're using (3000 by default). It might look like: 192.168.1.20:3000.
If you have the Today Widget in the Notification Center, you can start the workflow from there; it should populate a list of zones by querying the Node.js server.
- If you have any questions / comments, submit an issue or send me an email at varun@randery.com.
- Feel free to start a pull request if you have any ideas.