[PLUGIN] MQTT Client Plugin (Volumio 4) - Weekend Project

Dear Volumionauts,

A weekend project that scratches an itch.

There was a recent ask about MQTT support for Volumio 4. The old status2mqtt plugin is abandoned - original author moved on to other solutions. Rather than let it sit, I put together a fresh implementation over the weekend.

What it does:

  • Publishes Volumio state to MQTT broker (track info, playback status, volume, etc.)
  • Subscribes to command topics (play, pause, stop, next, prev, volume, seek, etc.)
  • Works with Home Assistant, OpenHAB, Node-RED, or any MQTT broker
  • Supports TLS/SSL and certificate authentication
  • Customizable topic structure (default: volumio/{device_id}/…)

What it is NOT:

  • A polished, fully supported product
  • Something I can commit to maintaining long-term
  • Tested on every possible configuration

I already maintain several Volumio plugins as a volunteer in my spare time. This one exists because it was not difficult to scribble together for an average nerd on a Saturday evening. It works for me. It might work for you.

Available in the plugin store once publishing completes.

Source will be available. If you want to fork it, adopt it, improve it - go ahead. Pull requests welcome. If someone wants to take over as primary maintainer, even better.

Use it, break it, fix it, share it.

Kind Regards,

2 Likes

Dear Volumionauts,

MQTT Client Plugin - User Guide

This guide covers basic setup and usage. For complete documentation including Home Assistant and OpenHAB examples, see the full README.

QUICK START

  1. Install plugin from store (beta channel)
  2. Configure broker connection (host, port, credentials if needed)
  3. Enable plugin
  4. Verify connection in Volumio logs or your MQTT client

Minimum required settings:

  • Broker Host (IP or hostname of your MQTT broker)
  • Broker Port (1883 for unencrypted, 8883 for TLS)

UNDERSTANDING TOPICS

MQTT uses a topic hierarchy like folders. This plugin uses:

{base_topic}/{device_id}/…

Default base_topic is “volumio”. Device ID defaults to your Volumio hostname.

Example: If your Volumio is named “kitchen”, topics will be:

  • volumio/kitchen/status (full state as JSON)
  • volumio/kitchen/status/title (current track)
  • volumio/kitchen/status/volume (0-100)
  • volumio/kitchen/set/play (send command here)

RECEIVING STATE (what Volumio publishes)

State topics under: volumio/{device_id}/status/

  • state - play, pause, stop
  • title - current track
  • artist - current artist
  • album - current album
  • volume - 0 to 100
  • mute - true or false
  • seek - position in milliseconds
  • duration - track length in milliseconds

Full JSON state also published to: volumio/{device_id}/status

SENDING COMMANDS (control Volumio)

Command topics under: volumio/{device_id}/set/

  • play - start playback (no payload needed)
  • pause - pause playback
  • stop - stop playback
  • toggle - toggle play/pause
  • next - next track
  • previous (or prev) - previous track
  • volume - set volume (payload: 0-100)
  • volumeup (or volup) - increase volume
  • volumedown (or voldown) - decrease volume
  • mute - payload: true, false, or toggle
  • seek - payload: position in milliseconds
  • repeat - payload: true, false, or toggle
  • random (or shuffle) - payload: true, false, or toggle
  • clear - clear queue

Example: To set volume to 50, publish “50” to volumio/kitchen/set/volume

MULTI-ROOM / GROUPS

Enable group topic in settings and set a group ID (example: “downstairs”).

Commands sent to volumio/group/downstairs/set/play will control all instances subscribed to that group.

TLS / CERTIFICATES

For secure connections:

  1. Set port to 8883
  2. Enable TLS in settings
  3. Provide paths to certificate files if required by your broker

TROUBLESHOOTING

  • Enable Debug Logging in plugin settings
  • Check logs: journalctl -f -u volumio
  • Test broker connectivity: mosquitto_sub -h {broker_ip} -t “volumio/#” -v
  • Verify firewall allows port 1883 or 8883

Kind Regards,

1 Like

@nerd - As promised, some initial feedback.

Once configured, as hoped it’s a full drop-in replacement for the old status2MQTT plugin.
Thus far running happily on three systems (2x Pi Zero 2W and 1s Pi3) and feeding the status etc back to my network and Home Assistant set-up perfectly, and fully controllable by HASS.

The only thing for me is the MQTT control of the devices.
I gave it a quick run-out, and whilst it seems to work, the devices take a while to respond (trying to toggle them). Just to confirm if I’m doing it right, tried sending volumio/radiopi/set/toggle/ with the payload of “toggle” (based on your two examples above - I’m assuming the payload is ignored here anyway).

I’ll play with it some more - I think it’s working but the lag (probably due to being a Pi Zero2) is making it a bit difficult to be fully certain.

Great job anyway though, especially for a quick weekend project :smiley: