Install node-sonos-http-api on CentOS 7

node-sonos-http-api is a simple tool for controlling Sonos devices with an API like function, that makes controlling Sonos via Home Assistant (or similar platform) super easy.

I am running node-sonos-http-api on a dedicated LXC instance, with 256M RAM and 1 vCPU. I am using Home Assistant's Command Line Switche Component to toggle various actions such as playing specific playlists at a specific volume, turn off all Sonos at bedtime, etc.

For this guide, both SELinux and firewalld is assumed to be disabled.

Let's Get Started!

1.) updates and pre-requisites:
yum -y install git && yum -y update
wget -O /tmp/   # Download script to add node repo
bash /tmp/   # Add node repo
yum -y install nodejs    # Install nodejs
npm install npm -g
2.) install node-sonos-http-api:
cd /opt
git clone   # Download node-sonos-http-api
cd node-sonos-http-api && npm install --production   # install node-sonos-http-api dependencies
3.) systemd file:
vi /etc/systemd/system/sonosapi.service
Description=Sonos HTTP API Daemon

ExecStart=/usr/bin/node /opt/node-sonos-http-api/server.js

4.) cleanup:
rm -rf /tmp/
systemctl enable sonosapi.service

And that's it! It's a fairly easy install, and after the reboot, the service will be running on port 5005. There is no web interface, so I hope that's not what you were expecting. I'd recommend you take a look at the README file for this project to understand it's use.


Related Posts

Share on: Twitter | Facebook | Google+ | Email

comments powered by Disqus