Roon Command Line Control

@Ronald_Record I sure will! I have now several Roon events controlled by Domoticz. For Roon status updates I use the MQTT extension, works great! For Roon control I now use the Roon-HTTP-API which works well but calling HTTP for every Roon action is a lot of programming in Domoticz. I’m going to migrate these HTTP calls to your extension. One thing I am missing in your extension (or maybe I’ve overlooked?) is setting the Volume for a Zone to a certain level.

This is by far the most usefull extension yet if you want my opinion. I’ve been playing around a bit and it’s working great. I did not find out how to set Volume yet. I think it is not yet possible? If you plan to add Volume, keep in mind that there are two kinds of Roon devices. Some having volume from 0…100% and some have volume from -80…0 dB. So setting a negative volume should also be possible (set volume to -30 dB for example). Great work!!!

@Ron_Witkamp thanks! Your suggestion to add zone volume control to RoonCommandLine is a good one. There does appear to by some volume control support in the Python Roon API but I have not yet played with it. I will look into it.

Please continue to make good suggestions.

1 Like

@Ron_Witkamp I have published RoonCommandLine Version 2.0.4 Release 1 which includes support for volume control. Volume can be adjusted for a specified zone or all zones in a zone grouping. The volume can be set using either an absolute volume level between 0 and 100 or a relative volume increment/decrement (positive or negative).

The command `roon -v volume` sets the volume level in the selected zone.

The `volume` argument has the format `[g:][r:][s:]num`

Where `g` indicates set volume for all zones in the group
      `r` specifies use relative method volume setting
      `s` specifies use relative_step method volume setting
      `num` can be absolute (0-100) or relative (negative or positive)

@Ronald_Record great work! Compliments for the speed in which you’ve managed to add Volume control. There is one small issue. Roon devices controlled by DSP for the volume have a Volume slider from -80db to 0db. RoonCommandLine only accepts Integers as Volume parameter. These devices require a negative Volume, for example -40dB is a volume setting of 50%, -20dB is 25% and so on.

In Domoticz a negative volume is a simple recalculation to a volume in percents which I then send to RoonCommandLine. (if negative then: RoonVolume = 100-(RoonVolume * -1.25) ). So this small issue is perfectly ‘workaroundable’ :slight_smile:

Thanks again for the great work!

dbvolume

@Ron_Witkamp you’re welcome! RoonCommandLine examines the selected output ID and checks for the volume “type”. If this output’s volume is of type “db” then it converts the provided volume level from the 0-100 value into -80dB to 0dB. So I’m doing the conversion for you on my end while, if I understand you correctly, you must perform the conversion from dB to decimal on your end in order to invoke RoonCommandLine volume control. Is that correct?

Perhaps a future release of RoonCommandLine could provide expanded support for volume control by adding some flag or something that says “This volume level is being provided in dB”. This would require a modification to the pyroon pip module as well since it is catching all absolute volume level settings and performing this conversion if necessary. So, it’s not that simple.

For now I believe we have a situation where a conversion may be necessary on both ends. Inefficient but workable.

Let me know if you have any suggestions as to how best to deal with this.

Love it! Running this on my core – with the volume keys mapped to bash commands via BetterTouchTool (BTT calls python3 /usr/local/Roon/api/set_volume.py -r -v -2 and python3 /usr/local/Roon/api/set_volume.py -r -v 2). This way, my Ortho Remotes that are connected over bluetooth are nice little volume knobs for my Roons zones (when twisted left or right, they emulate volume up and down). Works like a charm.

One remaining question: I can’t seem to get mute and unmute to work (the commands run, but no muting in Roon). Also: I would very much like mute to behave as a toggle (like playpause) – would that be possible at all?

1 Like

@RBM excellent! That sounds like a cool setup. I revisited mute/unmute testing after reading your question. It looks like there is a bug in the zone_command.py script wrt muting. It works for me with grouped zones but not with ungrouped zones. I think the fix is easy. Can you verify that on your system muting/unmuting works with grouped zones? I will go ahead and make the fix, just want to be reassured my examination of this is correct.

Hey @Ronald_Record – Confirmed: muting/unmuting with grouped zones works just fine. Thanks for looking into this. :smiley:

@RBM A new release with this bug fix is now available at RoonCommandLine Version 2.0.4 release 2 · Ron Record / RoonCommandLine · GitLab

The only change between 2.0.4r1 and 2.0.4r2 was to the file zone_command.py so you could just grab that file but I recommend using the Debian format installation package.

Onward and upward!

Man, that’s quick! Anyway – confirmed working! :smiley:

Now about that toggle…

@RBM yes, I will look into toggling the mute. That will require more change than I was comfortable pushing out quickly. Also, there are a couple of different ways I am thinking about doing this. One would preserve the current mute/unmute commands while adding a third “toggle mute” command. The other would replace the current mute/unmute with a single “mute” that toggles between mute and unmute. Which do you think is better?

1 Like

I would follow Roon keyboard shortcut behaviour (Ctrl-M for toggling mute/unmute, in the same vein that spacebar toggles for play/pause). I can’t see a scenario in which I’d use mute/unmute in a different way than toggling – doesn’t muting/unmuting always imply activating the opposite state compared to the current one?

At some point, if you’ve muted an endpoint you have to unmute it, so I also can’t see see any benefit to having a mute and and an unmute command.

Your wish is my command!

Mute toggle wasn’t trivial but I have something in test. I had to query the outputs to see if they are muted or not. I may be able to do something similar with shuffle/unshuffle and repeat/unrepeat. I have not checked to see if those are also properties of an output or some other object accessible via the api. If I can also make shuffle and repeat toggles would that be preferable to the current usage (separate commands for shuffle/unshuffle and repeat/unrepeat)?

I think it makes sense to toggle shuffle, as it’s either on, or off, but I’m not so sure about repeat as this has three states - maybe you just use the command to cycle through the three states, much as the button does in Roon.

@DaveN that does make sense. However, after looking a little more deeply into shuffle and repeat in the Python Roon API, these are zone properties rather than output properties. I can still implement this but it is more complicated and prone to error (on my part). It’s on my TODO list but it is not going to happen right away. Mute toggle will be released soon.

1 Like

RoonCommandLine Version 2.0.4 Release 3 now available. Below is a brief description of changes in the recent releases as well as download and installation instructions.

RoonCommandLine version 2.0.4 release 3 is a feature modification release.

This release changes the mute/unmute commands to a toggle. Both commands operate exactly the same, toggling the muting/unmuting of the selected zone or zone grouping. The two commands are retained rather than removing unmute in order to preserve compatibility with any existing scripts that use these commands.

RoonCommandLine version 2.0.4 release 2 is a bugfix release.

This release fixes a bug with muting/unmuting ungrouped zones.

RoonCommandLine version 2.0.4 release 1 adds zone and zone grouping volume control.

The command `roon -v volume` sets the volume level in the selected zone.

The `volume` argument has the format `[g:][r:][s:]num`

Where `g` indicates set volume for all zones in the group
      `r` specifies use relative method volume setting
      `s` specifies use relative_step method volume setting
      `num` can be absolute (0-100) or relative (negative or positive)

RoonCommandLine version 2.0.3 release 2 adds several new commands including support for playing a specified track by artist, playing a specified album by artist, playing either a specified artist or album in designated genre, playing a specified composer, and additional listing options. Listing and playing commands now include support for artist and album name exclusion strings allowing searches for a specified artist/album/composer/genre/playlist whose name includes a specified string but not another string. This exclusion filtering enables narrower listing, searching, and playing of library media.

Checks for Python 3 and Pip have been added to pre-installation scripts, MacOS installation has been significantly improved, installation of the roonapi Pip module is handled more gracefully.

RoonCommandLine version 2.0.x releases add support for detection of the Roon Core port as well as its IP address. The port number is stored in roon_api.ini and used in all subsequent calls to the Python Roon API. This was necessary as Roon Labs changed the port number in the most recent update. Extensions shouldn’t be assuming a hard coded port number anyway so this change prompted a good improvement although it was irritating at first. A bug introduced by the change to return status of the Bash builtin type command was addressed. RoonCommandLine commands’ location are added to PATH or full path used in SSH invocations. The installation script has been revised to work with the updated Python roonapi module version numbering. SSH invocations should work in a wider range of environments with this release.

The installation automatically detects and stores the Roon Core IP and port. There is no need for any manual configuration.

IMPORTANT NOTE Older versions of RoonCommandLine will no longer function properly. In order to use RoonCommandLine you must install version 2.0.2 release 1 or later.

Download the latest Debian or RPM package format release

Install the package on Debian based systems by executing the command

sudo apt install ./RoonCommandLine_2.0.4-3.deb

Install the package on RPM based systems by executing the command

sudo yum localinstall ./RoonCommandLine-2.0.4-3.rpm

Removal of the package on Debian based systems can be accomplished by issuing the command:

sudo apt remove rooncommandline

Removal of the package on RPM based systems can be accomplished by issuing the command:

sudo yum remove RoonCommandLine

To install on Mac OS X, clone the repository and execute the Install command:

git clone https://gitlab.com/doctorfree/RoonCommandLine.git
cd RoonCommandLine
./Install

Yep, that works well.

A quick question: when a new version is released and the install script is run is there any possibility it could check for the existence of ‘roon_api.ini’ and merge the non-crucial details into the new version (i.e. merge the ‘default’ and ‘group’ data, while possibly overwriting RoonCoreIP and RoonCorePort, and anything else that might need to change)?

1 Like