Roon module for Home Assistant

Thanks so much for this Shivrang. It is now working fine – and without any real intervention. Now that I reflect more carefully, I think it was a problem with my home assistant set-up. Thank you again, and thanks to Marcel for developing and sharing this.

can you please try to grab the latest version from github as both issues you’re describing should be fixed.

Thank you. It appears to be working well.

Hi Marcel,

I’ve been running the latest version of the component (https://github.com/marcelveldt/roon-hass/commit/ff3422a140bcada23779b09ab8e60e4bfe3e456e) for a month; the player widget is still non-functional, and calling media_player.play_media through home assistant still shuffles the playlist (without enabling “shuffle” in Roon). Given that the component seems to be working perfectly both for yourself and others, I can’t help thinking that the issues I’m experiencing arise from my system setup, though I don’t understand why they would. I run roonserver and home assistant on the same server (ubuntu bionic), using the hassio docker images for a generic x64 install.

Whenever I use the player widget, my homeassistant logs show the following error (this happens with both playlists and radio):

2019-02-01 10:25:04 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/config/custom_components/media_player/roon.py”, line 722, in hass_event
if changed_entity in self.source_controls or changed_entity in self.volume_controls:
TypeError: argument of type ‘NoneType’ is not iterable

The only possible issue I can think of is that there is an issue with the networking between the hassio docker container and the host system. There are a couple peculiarities in my setup. First, autodiscovery of my Roon Core doesn’t work, so I have to manually specify the host (either localhost or LAN IP – ie. 192.168.. – addressing works). Secondly, due to a widely experienced DNS issue for those running hassio under docker on Ubuntu, I manually call socat to forward DNS queries to my home assistant container.

As for my issues playing playlists, when using the latest version of Roon.py, when I use media_player.play_media to start a playlist, the playlist entries are still shuffled (though shuffle is not ‘enabled’ on the Roon zone.

I’ve updated the module again on Github. Can you give it a try and report back ?
If it’s all working fine now I’ll submit it to hass for official inclusion

Hi Marcel,

I’ve tried the new version of the module, and the playlist plays without shuffling. This is great for me; many thanks! Unfortunately, the module still generates an error when using the widget. I get one error when using input_select to choose a player, and another when using it to select a playlist/radio.

2019-02-02 15:44:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/config/custom_components/media_player/roon.py”, line 741, in hass_event
if changed_entity in self.source_controls or changed_entity in self.volume_controls:
TypeError: argument of type ‘NoneType’ is not iterable
2019-02-02 15:44:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/config/custom_components/media_player/roon.py”, line 741, in hass_event
if changed_entity in self.source_controls or changed_entity in self.volume_controls:
TypeError: argument of type ‘NoneType’ is not iterable

Hi -
I just tried the new version as well and had the same experience. The media player itself works very well, but I receive the exact same error message that Shivrang reports when using the widget. Thank you again for your work on this.

Hi Marcel,

After many days of uptime, I can also confirm that the component reconnects to Roon effectively after it loses a connection to the server.

Thanks,

Shiv

@Marcel_van_der_Veldt can you explain how to use tts?

OK, great. I have the same experience in my own setup. It now reconnects fine if the server is rebooting or the connection is temporarily lost.
Now, only thing left is to fix the issue with the playlist widgets and it’s all set for submitting to hass.

Well, I kind of hacked in support for that my using mqtt and some custom code on pi roon endpoints.
So, unless you’re using roonbridge clients as endpoints, it’s kind of useless.

Since I would like to use airplay endpoints I hacked my way around a solution using a script and shell command in HA which creates a wav file containing the TTS and puts it on a share which is accessible by Roon. I use your (highly appreciated!) custom component to play a playlist containing the TTS file to any of my endpoints. I need to do some more testing but it seems to work.

1 Like

Roon custom component doesn’t work with HA version 0.88.0 due to constants were moved.
Can you fix, please?

I’m on it, update expected in a few hours

2 Likes

Any progress?

New version is on the repo now.
I had to do a complete refactor because hass is phasing out the old way of doing stuff.
Good news however is that the component can now be configured from the GUI.
Bad news is that the player widget stuff is removed as it could not be maintained. If people miss it, I’m planning on creating a Lovelace widget instead.

To migrate:

  • remove the old folder from custom_components
  • download the new files (subfolder roon into custom_components)
  • remove roon from your media_player config in hass
  • simply add roon: into configuration.yaml
  • setup from the hass GUI

Installed new version on hass.io 0.88.1 running on raspberry pi 3+

No extersion found in roon, and after about 20 sec the pi crashes

will test with another sd card tomorrow

2019-02-23 23:56:31 WARNING (MainThread) [homeassistant.loader] You are using a custom component for roon which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant. 
2019-02-23 23:56:38 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=8 from 2019-02-23 22:48:44.867222) 
2019-02-23 23:56:41 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 212, in async_update_ha_state raise RuntimeError("Attribute hass is None for {}".format(self)) RuntimeError: Attribute hass is None for <Entity yr Symbol: 3>

did you first click submit at the step where you need to authorize ?

hi @Marcel_van_der_Veldt,

Thanks for taking the time to re-factor the component! I’ve tried the new one, but can’t get it to show up under integrations.

It looks like something got discovered but I can’t read the text for the input fiels(might be host etc). Attached is a screenshot. Second screenshots shows what is on the screen when I click on configure.

Regards,
Wouter

using home assistant 0.88 ?

I’ve just updated the github repo again as I saw some stuff that needed fixing