Roon Extension: Publish to MQTT broker

Thanks for the quick response. I’ve got some Sonoff MQTT Broker on my ioBroker machine and it figures out, that this one is only working with Sonoff/Tasmota/ESP devices. Would check the official MQTT Broker on ioBroker on another listening port, but the Roon extension does not accept any other ports than 1883. Even when you type another, it still connects to the defined IP adress on port 1883.

@eFJee Hello!
Excellent Work! I am using the MQTT broker in conjunction with the M5Stack CORE2 device,
This tiny ESP device has a working integrated touchscreen and makes for the ultimate Roon Mini Remote.
Right now I-ve managed to cobble up a now playing screen with play pause next and previous buttons.The only snag I have is that if nothing changes, there is no way for me to know what the current song/album/artist is playing, ad the values only update when one of the values changes (es when the next song plays) Its there anyway of getting the current status? When I turn the device on I get no signficant info, Maybe you could publish all MQTT topics once every 10 seconds? Thanks again and my compliments for your excellent extension

@eFJee Quick update , I installed a node red instance on my server and created flow variables subscribed to all the topics I need to keep current. Since the node red is always running the flow variables contain the latest published info from Roon, and keep it persistent until the next change.
I then inject the flow variable every second into a new MQTT topic that is subscribed to by the M5 stack core device. Works great but a bit of a chore to set up if you need to access multiple data points for multiple rooms.
Maybe there’s a less cumbersome way? I’m Not an expert on node red or mqtt, just started this morning!
Regards
L.

The MQTT topics loose their value now, because the retain bit is not set by the extension. I am planning on changing that as soon as I have some time to work on it. I canb’t promise anything, but I will try to make time for it early in the new year.

Nice to hear you like the extension! Thanks!

Normally it is no good practice to do so. As soon as your mqtt client connects to the server it should get the latest values of all the topics.
Could you explain your usecase to understand it a little bit more?

I just pushed the new version (2.3.1) to github and docker hub. So if you want to use the latest (and hopefully greatest) you should update.

Norman Seibert contributed and added the ability to control shuffle, loop, seek and power/standby. Thanks!

Also I updated the extension to respect the MQTT port specified in the settings.

Enjoy!

1 Like

Works like hell :star_struck:
Thanks for the Update.

I am having issues with the commands to set shuffle and repeat. The extension is crashing. Here is the info I see when I try to set shuffle to true: I am hoping someone can tell me what I am doing wrong.

*** zoneevent=zones_seek_changed
*** we know of zones: BedHead,Family Room,GBR,Computer Default,Schiit Modius
*** zoneevent=zones_seek_changed
*** we know of zones: BedHead,Family Room,GBR,Computer Default,Schiit Modius
*** zoneevent=zones_seek_changed
received mqtt packet: topic=roon/Schiit Modius/settings/set/shuffle, message=true
*** we know of zones: BedHead,Family Room,GBR,Computer Default,Schiit Modius
*** change settings shuffle to zone with id=160102acccabf6a084ad1ac3e42969ef5d12
/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:231
                        shuffle: message.toString().toLowerCase()
                                 ^

ReferenceError: message is not defined
    at changeZoneSettings (/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:231:13)
    at MqttClient.<anonymous> (/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:104:7)
    at MqttClient.emit (events.js:198:13)
    at MqttClient._handlePublish (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:1547:12)
    at MqttClient._handlePacket (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:535:12)
    at work (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:438:12)
    at Writable.writable._write (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:452:5)
    at doWrite (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:307:11)
gerlin@tone:~/roon-extension-mqtt-master$

As far as repeat the doc says this:

roon/[zone-name]/[output-name]/settings/set/repeat

Though when I use that format, there is no response at all in the cmd window. If I remove the [output-name] value (basically using the same format as shuffle. I get the same type of crash.

*** we know of zones: BedHead,Family Room,GBR,Computer Default,Schiit Modius
*** zoneevent=zones_seek_changed
received mqtt packet: topic=roon/Schiit Modius/settings/set/repeat, message=disabled
*** we know of zones: BedHead,Family Room,GBR,Computer Default,Schiit Modius
*** change settings repeat to zone with id=160102acccabf6a084ad1ac3e42969ef5d12
/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:236
                if (message.toString().toLowerCase() === "one") {
                ^

ReferenceError: message is not defined
    at changeZoneSettings (/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:236:3)
    at MqttClient.<anonymous> (/home/gerlin/roon-extension-mqtt-master/roon-mqtt.js:104:7)
    at MqttClient.emit (events.js:198:13)
    at MqttClient._handlePublish (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:1547:12)
    at MqttClient._handlePacket (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:535:12)
    at work (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:438:12)
    at Writable.writable._write (/home/gerlin/roon-extension-mqtt-master/node_modules/mqtt/lib/client.js:452:5)
    at doWrite (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/home/gerlin/roon-extension-mqtt-master/node_modules/readable-stream/lib/_stream_writable.js:307:11)
gerlin@tone:~/roon-extension-mqtt-master$

I am having no issues with sending “control” commands (play, pause, etc.) . I am also able to start playback with “browse” commands. Shuffle is okay when included with the browse command.

The roon core 1.8 (build 913) is running on Ubuntu 20.04. I am sending mqtt commands from node-red via Mosquitto mqtt broker v1.6.9.

Any help is appreciated.

I was able to resolve the issue with repeat and shuffle by modifying the roon-mqtt.js file, adding message: as an argument to the changeZoneSettings function.

Here is a diff of what I modified:

user@tone:~/roon-extension-mqtt-master$ diff roon-mqtt.js roon-mqtt.js.ORG
104c104
<                                               changeZoneSettings(roonZone, setting, message);
---
>                                               changeZoneSettings(roonZone, setting);
227c227
< function changeZoneSettings(roonZone, setting, message) {
---
> function changeZoneSettings(roonZone, setting) {

The repeat mqtt topic that works for me is roon/[zone-name]/settings/set/repeat

I could not get the documented roon/[zone-name]/[output-name]/settings/set/repeat to work. Though maybe output-name is optional and I don’t properly understand the syntax.

Thanks for this extension, it is very useful.

1 Like

Thanks for reporting and (even more so) fixing the issue. I’ll update the extension as soon as I am able to do so.

1 Like

I am also having the issue of not being able to use any of the “shuffle” commands. Has the “shuffle” bug been resolved or am I just doing something wrong?

I’m no longer using the extension myself, but I’ll try to find some the time to fix this in the coming weeks.

I just released version 2.3.2.

The issue pointed out by @louger shoudl be fixed. Thanks for you contribution!

1 Like

What are you using instead now ?

I used it to connect with my home automation system running Domoticz back then.
A while ago I switched from Domoticz to Home Assistant. As Home Assistant has a native Roon extension, I don’t need the MQTT extension anymore.

2 Likes