Skip to content

morphZ/volumio-mqtt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

volumio-mqtt

NodeJS MQTT adapter for volumio.org music player, to control your player using MQTT messages.

For example, if you have configured your mqtt_devicename in config.js to "player-01", you can control it by sending MQTT messages to topic "player-01/set/play" to start playback, or "player-01/set/volume/percent" and a payload of 50 to set volume to 50%.

Configuration

Copy config.js.sample to config.js and adjust your settings: Define mqtt_devicename (the prefix for mqtt messages) and mqttHost with the address of your mqtt broker.

config.js is listed in the .gitignore list and will not be overwritten when you pull from the git repository.

Install PM2 process manager

Optional: You can use PM2 to run this script automatically on each reboot.

$ sudo npm install pm2 -g

$ pm2 startup

[PM2] Init System found: systemd

[PM2] To setup the Startup Script, copy/paste the following command:

sudo env PATH=$PATH:/bin /lib/node_modules/pm2/bin/pm2 startup systemd -u volumio --hp /home/volumio

$ pm2 start pm2-process.json

$ pm2 list

$ pm2 save

MQTT Topics:

Setters:

Topic | (Payload)

  • {devicename}/set/volume/percent (0 - 100)

  • {devicename}/set/volume/mute (true | false)

  • {devicename}/set/volume/push (+ | -)

  • {devicename}/set/volume/up

  • {devicename}/set/volume/down

  • {devicename}/set/power (true | false)

  • {devicename}/set/play

  • {devicename}/set/addPlay {"service": "webradio", "title": radioURI, "uri": url}

  • {devicename}/set/stop

  • {devicename}/set/pause

  • {devicename}/set/seek (seconds)

  • {devicename/set/addPlaylist} (name of playlist)

Getters:

  • {devicename}/get/status
  • {devicename}/get/browsesources
  • {devicename}/get/browselibrary
  • {devicename}/get/multiroomdevices

Status responses:

  • {devicename}/status/connected
  • {devicename}/status/info
  • {devicename}/status/volume
  • {devicename}/status/browsesources
  • {devicename}/status/browselibrary
  • {devicename}/status/multiroomdevices

Volumio player API reference https://volumio.github.io/docs/API/WebSocket_APIs.html

Additional options in config.js:

  • mqtt_tvenabledtopic: You can configure the volumio playback to stop when you turn on your TV (or by any other device, e.g. on an incoming phone call) by specifying a topic name to listen for. The device will listen on MQTT for the specified topic and stop playback (assuming your TV will send out an MQTT message on power up). Currently limited to a single MQTT topic name.

  • mqtt_powerToggleAddr: You can configure to emit an MQTT message on play and stop of volumio by specifying an outgoing MQTT topic name in "mqtt_powerToggleAddr". This can be used to turn on/off a power outlet (e.g. your amplifier). Currently limited to a single MQTT topic.

About

NodeJS MQTT Adapter for volumio.org Player

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%