Roon Extension: Publish to MQTT broker

Today I created my first Roon extension with NodeJS. Also my first NodeJS experience BTW :slight_smile:.

The extension pushes all zone information from the RoonApiTransport subscription to the MQTT broker. That way you can use all the status information in Domotica systems like OpenHAB.

I published the extension on my github account: https://github.com/fjgalesloot/roon-extension-mqtt so you can have a go with it.

The next step is to listen to incoming MQTT methods to allow zone/output player controls.

Screenshots

Extension settings page:

As you can see, you can set the Hostname or IP address of the MQTT broker in the extension setting page. Also the status of the MQTT broker connection is displayed.

I think it all works, but you could encounter issues :wink: as this is version 0.1. I would like to know what you think.

5 Likes

I like the idea of providing a systemd service to start the extension.

Just to understand what this is;
Could it be used to publish something like now playing to your FB account?

Or how is it intended to be used ?

I’d imagine future releases will have some kind of mechanism for sharing / storing / activating extensions from within Roon – but for now a systemd service and dumping the output straight to /dev/null works fine.

You can use it with anything supporting receiving/interpreting MQTT messages.Personally I use it with OpenHAB, but I can imagine lots of other domotica systems able to connect to a MQTT broker to receive (and send) messages.

For example, my OpenHAB system now knows if and what is playing in the different zones I configured. I can setup automation rules to do things in certain conditions. For example, let OpenHAB turn off my power amps (with a smart swtich) when the zone in my living room is stopped.

3 Likes

Yesterday I tried to connect my domoticz home automation system (I used OpenHAB before) to Roon with the extension. For this to work I needed to use Node-RED to connect it to the right topics available. While debugging I noticed the extension was publishing all topics for a zone when this zone was updated. While playing, the zone gets updated all the time with the new position in the track, so that means a lot of unneeded messages on the MQTT broker.
I changed the code so it only sends the changed topics to the MQTT broker. So, when only the position changes, only the MQTT topic for the position gets an update. This works much better in event-driven systems.

Just wanted to say thanks for this extension, works great. I disabled some of the online publishing cause it seemed to get really wordy.

Great to know the code is actually useful for people other than myself. So thanks for sharing!

Thanks for creating this extension! I am new to Roon, new to MQTT, new to NodeRed, and new to Home Assistant, but will be giving this a shot and putting those puzzle pieces together!!

Hello!
I recently installed this extension, but I have problem.
My Roon core see broker, and they are connected, but I need to know what should I do to see messages on broker server, wich Roon send?
I want to see it on terminal, i try mosquitto_sub -v -h 192.168.1.232 -p 1883 -t ‘#’ command , but nothing happened.

The extension sends all the information to the topic roon/<Zone Name>/

All the properties of Zone Class defined in the Roon API are pushed. So for example for a zone named LivingRoom, the topic where the state is published will be

roon/LivingRoom/state

Only changes are published, so when nothing happens, no messages are published.

Do you perhaps have multiple brokers running. Subscribing to another one the extension is publishing to?

I have it running! Nice work! I encounter one problem and that is that the extension stops when I exit Roon. I get following error when that happens:

Update: the error only occurs when closing Roon on my Windows 10 PC. Closing the Roon app on Ipad or Android phone does not cause the error.

events.js:183
throw er; // Unhandled ‘error’ event
^

Error: read ECONNRESET
at _errnoException (util.js:1022:11)
at TCP.onread (net.js:615:25)

Anyone else having problem since the Roon 1.7 update? I can only see status messages (stopped, playing, loading) and no more messages saying what is played

Looks like it’s still working for me…

Where is you Core running? Is it running on the Windows 10 PC?

Hi Floris Jan,

My core is running on a Roon Rock NUC, MQTT broker on a Synology NAS

Ron

Roon is not sending any MQTT message when I play radio stations. MQTT for music from my own library and Qobuz are working fine

Very strange behaviour here. On my NAS I have the problems as decribed. Reinstalled MQTT and still the same problem. Installed MQTT extension on a spare Linux NUC and that worked fine. Same MQTT version, other OS. I have a workaround in place and will try to install on another Synology NAS with other specs.

Great Extension, however with a setup similar to Ron_Witkamp, I am also having the same end result with 1.7. My setup is Nucleus+ for core with MQTT Broker in Docker on Synology NAS. Status messages are also stopped, playing and loading but its not possible display what is playing. It would be fantastic to have this issue fixed moving forwards. Thanks for your help

Hi Great initiative! works fine! some Q and feedback. (running openHAB)

  • gets hundreds of “true” with same timestamp at “roon/online” topic.
  • any way to “control” (Start/Stop, Volume)?
  • how can i get coverart ( using topic “roon/Nere/now_playing/artist_image_keys/0” ? )

any plans doing roon openHAB binding?

kind regs Anders

1 Like