Thanks for the feedback and testing, both of you. I have reviewed the code and I can confirm the command handling logic is working correctly - but both issues appear to be topic structure problems. Let me explain what is happening and how to fix it.
@DarrenHill - Toggle command with trailing slash
WHAT YOU ARE DOING WRONG:
You are publishing to: volumio/radiopi/set/toggle/
(note the trailing slash at the end)
The plugin subscribes to: volumio/radiopi/set/+
In MQTT, the + wildcard matches exactly ONE topic level. Your trailing slash creates an EXTRA empty level:
Your topic: volumio / radiopi / set / toggle / (empty)
1 2 3 4 5
Subscription: volumio / radiopi / set / +
1 2 3 4
The subscription pattern expects 4 levels. Your topic has 5 levels. The message never reaches the plugin because MQTT considers these as non-matching.
WHAT YOU SHOULD DO INSTEAD:
Remove the trailing slash. Correct examples:
Topic: volumio/radiopi/set/toggle
Payload: (empty or anything - ignored for toggle)
Topic: volumio/radiopi/set/play
Payload: (empty or anything)
Topic: volumio/radiopi/set/volume
Payload: 50
The ālagā you experienced is likely from inconsistent trailing slashes in your testing - some attempts matched, others did not.
@Mustang65 - ioBroker cannot send commands
WHAT IS LIKELY HAPPENING:
You can receive state data (plugin publishes to your broker successfully) but cannot send commands. This means the plugin is not receiving your messages, which points to a topic mismatch.
WHAT TO CHECK:
- Verify your exact topic structure in ioBroker. The plugin expects:
{base_topic}/{device_id}/set/{command}
For example, if your base_topic is āvolumioā and device_id is āmyplayerā:
volumio/myplayer/set/play
volumio/myplayer/set/pause
volumio/myplayer/set/toggle
volumio/myplayer/set/volume (payload: 0-100)
-
Check your plugin configuration in Volumio:
- What is your āBase Topicā setting?
- What is your āDevice IDā setting? (if blank, it uses hostname)
-
Alternative JSON command format - you can also send to the /command topic:
Topic: volumio/myplayer/command
Payload: {"command": "play"}
Topic: volumio/myplayer/command
Payload: {"command": "volume", "value": 50}
- Enable debug logging in the plugin (Debug Settings section) and check Volumio logs:
journalctl -f -u volumio
Look for lines starting with [MQTT-Debug]. When you send a command, you should see:
[MQTT-Debug] Received message on topic: ... - payload: ...
[MQTT-Debug] Executing command: ... with value: ...
If you see NO log entries when sending - the topic does not match the subscription.
[QUICK REFERENCE - Valid command topics]
Assuming base_topic=volumio and device_id=myplayer:
PLAYBACK:
volumio/myplayer/set/play
volumio/myplayer/set/pause
volumio/myplayer/set/toggle
volumio/myplayer/set/stop
volumio/myplayer/set/next
volumio/myplayer/set/previous
VOLUME:
volumio/myplayer/set/volume payload: 0-100
volumio/myplayer/set/mute payload: true/false/toggle (or empty)
volumio/myplayer/set/unmute
volumio/myplayer/set/volumeup
volumio/myplayer/set/volumedown
OTHER:
volumio/myplayer/set/seek payload: position in seconds
volumio/myplayer/set/repeat payload: true/false (or empty to toggle)
volumio/myplayer/set/random payload: true/false (or empty to toggle)
volumio/myplayer/set/clear
JSON FORMAT (alternative):
volumio/myplayer/command payload: {"command": "play"}
volumio/myplayer/command payload: {"command": "volume", "value": 75}
IMPORTANT: No trailing slashes on any topic.
Let me know if you still have issues after checking these points. If ioBroker problems persist, please share:
- Your exact plugin configuration (base_topic, device_id)
- The exact topic path ioBroker is publishing to
- Any debug log output from the plugin
Kind Regards,