Homebridge Roon Outputs - Basic endpoint control with Apple HomeKit

I’m after some guinea pigs for a Homebridge platform I’ve just put together.

Keep in mind it’s very green and functionality is extremely limited right now - play/pause only, and it automatically creates accessories for you. We can look at ways to expand functionality later on. For now it acts as a way to add our Roon output devices to your Home app.


This looks great. I’ll give it a go over the weekend.

Great work! Works fabulously. Hoping the transport and volume controls can be figured out.

Oddly caused some issues today. Something about address collisions and it brought down my whole homebridge causing continuous service restarts.

I had to remove the plugin. Here is the snippet of logs:

[8/8/2020, 7:22:12 PM] TypeError: Cannot read property ‘send’ of undefined
at Transport.send (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/transport-websocket.js:32:13)
at Moo.send_request (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/moo.js:73:24)
at RoonApiTransport.control (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api-transport/lib.js:254:19)
at RoonOutputsPlatformAccessory.setTargetMediaState (/usr/local/lib/node_modules/homebridge-roon-outputs/src/platformAccessory.ts:98:50)
at TargetMediaState.emit (events.js:315:20)
at TargetMediaState.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22)
at TargetMediaState.Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:625:12)
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1437:24
at Array.forEach ()
at Accessory._this._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1279:10)
[8/8/2020, 7:22:12 PM] Got SIGTERM, shutting down Homebridge…
[8/8/2020, 7:22:17 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[8/8/2020, 7:22:22 PM] [HB Supervisor] Restarting Homebridge…

[8/8/2020, 8:55:21 PM] [Roon Speakers] Adding/Updating Roon Output External Accessory: Left Homepod Speaker
[8/8/2020, 8:55:21 PM] Error: Accessory Left Homepod Speaker experienced an address collision.
at /usr/local/lib/node_modules/homebridge/src/server.ts:575:15
at Array.forEach ()
at Server.handlePublishExternalAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:555:17)
at HomebridgeAPI.emit (events.js:315:20)
at HomebridgeAPI.publishExternalAccessories (/usr/local/lib/node_modules/homebridge/src/api.ts:302:10)
at RoonOutputsPlatform.addAccessories (/usr/local/lib/node_modules/homebridge-roon-outputs/src/platform.ts:117:16)
at /usr/local/lib/node_modules/homebridge-roon-outputs/src/platform.ts:73:16
at Object.cb (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api-transport/lib.js:349:40)
at Moo.handle_response (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/moo.js:196:21)
at Transport.moo.transport.onmessage (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/lib.js:413:22)

Working perfectly for me.
A while back I built a Python Flask API that did a bunch of Roon control - playing specific playlists and radio, randomly playing favourite albums, tags, etc. Not sure how possible that would be in HomeKit given the limitations of speakers? Happy to dust off my node skills and give it a crack though.

Ahh I spoke too soon. Also getting the address collision issue…

[17/08/2020, 2:10:18 am] Error: Accessory DX3 Pro Roon experienced an address collision.
    at /usr/local/lib/node_modules/homebridge/src/server.ts:575:15
    at Array.forEach (<anonymous>)
    at Server.handlePublishExternalAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:555:17)
    at HomebridgeAPI.emit (events.js:314:20)
    at HomebridgeAPI.publishExternalAccessories (/usr/local/lib/node_modules/homebridge/src/api.ts:302:10)
    at RoonOutputsPlatform.addAccessories (/usr/local/lib/node_modules/homebridge-roon-outputs/src/platform.ts:117:16)
    at /usr/local/lib/node_modules/homebridge-roon-outputs/src/platform.ts:73:16
    at Object.cb (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api-transport/lib.js:349:40)
    at Moo.handle_response (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/moo.js:196:21)
    at Transport.moo.transport.onmessage (/usr/local/lib/node_modules/homebridge-roon-outputs/node_modules/node-roon-api/lib.js:413:22)

Thanks for the logs @Sreechandra_Donepudi and @Nic, I had this during my testing too. Restarting Homebridge seemed to bring things back to normal. I’ll see if there is anything that can be done to prevent this - so keep posted.

@Nic the Roon Node API is super capable and full transport/volume controls would be a cinch (more or less), however there is a hard limitation with the SmartSpeaker service provided by Homebridge. The only thing that works at the moment is Play/Pause. I’m not sure if the problem exists on the Homebridge end or if it’s on Apples side. Basically SmartSpeakers are meant to be running Airplay 2. I don’t think it’s possible (yet) to fudge Airplay 2.

If it keeps happening I’ll pop my logs onto debug and post (although Homebridge in debug mode with a couple Sonoff switches and a Samsung TV creates a lot of log!).

It’s a shame that richer control isn’t possible with Homekit. The Homebridge plugin I use for my Samsung TV has some good configurability with switches and a scroll selector. I wonder if there’s a possible solution like that? A scroll selector for playlist/radio etc. Screenshot below. It looks ugly but doesn’t really matter given everything is triggered with scenes and voice commands…

This is pretty cool, thanks for this. Have been able to get up and running very quickly using Homebridge Web UI on my Synology. Play/Pause works nicely when tapping on speakers in the HomeKit control center UI or in the HomeKit app. Is there a Siri command that equates that action? It doesn’t seem to be “play [/pause] playback in …” because that just shows the disabled playback UI.

I achieved that with the Shortcuts app. “Play Roon” sets my main Roon output to play, “Play Office” sets my office output to play. You could also achieve it with a Scene in the Home app.

Pro-tip for the Shortcuts app (because it took me about half an hour of tapping around to work this out), whatever you name the shortcut, is the command in Siri. But…there seem to be some special commands regarding music that can’t be overwritten - so naming a shortcut “Play music” is a bad idea, as it will try and open Music on your phone. (although randomly, sometimes it will do whatever you set the shortcut to)

1 Like

Thanks for the pointers Nic! Up and running with Siri commands and HomeKit scenes now, fantastic :slight_smile: I can just raise my wrist and say “Scene: Music” or “Scene: Pause” to start/stop playback in my whole apartment since all the speakers are grouped. You were right it was a little tricky finding the right keywords because stuff like “playback”, “Roon” or “music” would interfere with system functionality. For me the ultimate fix was to prepend the word “Scene” (not in the name of the scene itself, though).

I am currently doing this via homebridge-http plugin and the Roon Api installed on the Raspi runnig homebridge.

But I‘ll give this one a try over the next days.

To follow up on this, the keyword issue doesn’t seem to apply if you use the Shortcuts app. I have created a shortcut for “Music On” that toggles the HomeKit scene, which works perfectly via Siri.

1 Like

I‘m continuing to use this plugin every day to start and stop playback, so thank you!! Unfortunately I need to re-enable the extension in Roon quite often. I‘ve read somewhere that this could have to do with an unwritable working directory when running through Docker. Do you have any experience with this @jptaranto

That’s awesome to hear @saschamt!

I’m actually experiencing this exact issue after moving my Homebridge setup to docker. I started looking into it but haven’t got very far.

Roon Node API stores credentials from your Roon Core in a file called config.json when you allow the extension. This is the same filename Homebridge uses for all of its config too, which is why some might have noticed Roon generated credentials inside their Homebridge config.

The docker issue could be because Roon is writing to a location that isn’t persisted. I did dig into the Node API and it writes this config.json file to the working dir. It could just be a matter of figuring out where that is in the Homebridge docker container and persisting it. Otherwise I’ll need to either add in some ability to change the location or even submit a pull request to the Roon Node API so we can choose where the credentials are stored.

I’ll have a stab at this over the next week or so.

1 Like

Ok @saschamt, challenge accepted. Take back what I said about next week.

I’ve implemented a pretty hacky fix for this in a new version 0.1.3, update to get the goodness.

You should see a new roon/config.json file inside your docker Homebridge folder that contains the creds and your core should stop forgetting your Homebridge now.

Some other fixes in 0.1.3 for other peoples reference:

  • Change the postfix config key to suffix. Kind of a nicety. This will default to Speaker if you don’t update your config.
  • Ability to configure this value via Homebridge config UI. Click Settings next to the plugin.
  • Fixed a few log messages.
  • Experimental fix to write Roon auth credentials to a better location. For anyone updating that isn’t using Homebridge via docker, you can remove the roonstate info inside your config.json file now. You will need to re-enable the extension in Roon however.

Let me know how you go.

1 Like

I really appreciate the friendly and informative reply and your need to go and check what can be done with it pretty much immediately. Updated and will let you know how it goes. Thank you!!!

Thanks very much for the Homebridge/Homekit control. I am using it for setting a scene for playing my song for getting ready for the work day.

Nice one @Carlton_Spence! Thanks for letting me know. What’s the song if you don’t mind me asking?

Enablement seems to stick @jptaranto!! Thank you SO much! :slight_smile: