Webhooks on rooMax

@RBM suggested I that opened a new thread to ask questions about setting up the webhook functionality for rooMax. Feel free to move it if it’s in the wrong place :slightly_smiling_face:

I feel I’m a bit in over my head here but I want to try and understand how this could work on my system because it looks like there are a lot of uses. Ideally this:)

From the rooMax thread:

My goal is to use webhooks to execute different functions in Roon via RoonCommand. Eg making a specific album play when pressing a button on the rooMax remote without having to first create a playlist with the album.

First up - I fear that I need some new hardware as RoonCommand runs only on MacOS or Linux. My core runs on Windows. I have a Pi 4B (2GB) that runs rooExtend. Is there a way to run rooExtend and RoonCommand on the same Pi or do I need another one?

So my understanding so far is: I run (some form of) Linux on a Pi. Then install RoonCommand and a webhook server on the Pi.

Webhooks are new to me but it seems to be an address with a command attached. Do I write these in the rooMax interface when attaching it to a button and then the Pi with RoonCommand and the webhook server runs headless and there is no reel need to access it apart from updating?

Hey @TreeZorro

I was hiking through Luxembourg the last week and a half – just returned home. :slight_smile:

A webhook server is basically a small webserver accepting named commands through a local URL + predefined port. A (free) lightweight webhook server is found here:

It is available in a number of precompiled binaries (also for Windows I see, but I’m afraid I’m of no help there…). I’m sure there are plenty alternatives as well. The action for the hooks is defined in a json file on the webhook server (a Pi would be a fine self-contained option).

In hooks.json I have this command (I wrap the RoonCommandLine commands in scripts since I use these for other purposes as well, but you could also put the command directly into the json if you’d like):

 {
    "id": "baroque",
    "execute-command": "/Users/rene/Documents/Xence/Baroque.shx",
    "command-working-directory": "/var/webhook"
 } 
,

The Baroque.shx script contains the following (playing a playlist to the defined zone, shuffled) :

/usr/local/bin/roon -z "KEF LS60" -p "Baroque Instrumental Chamber and Orchestral Music" -c shuffle

And finally, the webhook is called as follows (this is also the URL you’d put in the webhook definition in rooMax as well):

http://your.ip.address.here:9000/hooks/baroque

That about does it. Since I’m on a Mac, I have since abandoned this approach in favour of Named Triggers in the great BetterTouchTool that I already use for many other things – but that doesn’t help you much, I’m afraid… :wink:

That said, I believe that @DrCWO is looking into integrating RoonCommandLine directly – so if you’re not in a hurry, you may want to wait a bit:

Note: as this discussion is rather specific to rooMax, I have moved it to the rooExtend category.

1 Like

Never thought of Luxembourg as hiking country but of course there’s a lot hills :slightly_smiling_face: Sounds great.

Thank you for a very detailed answer and suggestions :+1: I also saw that DrCWO is working on integrating RoonCommandLine after I wrote this so I will probably wait for that for the Roon stuff.

But maybe in the meantime I will try to set up a webhook server on Windows just to see what else I can do with it together with rooMax.

1 Like

I have a bunch of python scripts that I use for controlling my (KEF LS60) speakers. I replaced most of the Roon-specific transport controls with these so they function regardless of source (Airplay, Spotify, Tidal Connect, etc.). Fun thing about RoonReadiness is that volume control keeps working all the time. For my other devices (Naim Mu-so 2 & QB 2), I have a couple of direct webhooks for transport & power options. Works out just fine for me. :slight_smile:

Hills – and rocks. The Mullerthal trails are beautiful.

2 Likes

The simplest approach is probably to wait for @DrCWO to integrate RoonCommandLine.

An alternative, though, is to use Home Assistant and the Roon Integration (RoonLabs music player - Home Assistant). Automations in Home Assistant can be configured to be triggered by web hooks. When you set an automation to be webhook triggered, Home Assistant automatically sets up the webhook endpoint.

For example, here’s a webhook triggered script that plays an album. It’s a simple matter to get rooMax to invoke this and to label the rooMax button whatever you like.

alias: Webhook - Fink
description: ""
trigger:
  - platform: webhook
    allowed_methods:
      - GET
    local_only: true
    webhook_id: "-BIY9DWYb2JXV_A499OiFL1tD"
condition: []
action:
  - action: media_player.play_media
    target:
      device_id: 188a74201f75d54f72fa53559b065667
    data:
      media_content_id: Library/Artists/Fink/Beauty In Your Wake
      media_content_type: music
mode: single
3 Likes

This sounds interesting. I looked a bit at Home Assistant. The Home Assistant Green seems like a relatively easy way to get started. Do I understand you correctly that I don’t need to set up a separate webhook server if I run Home Assistant?

I run it on a Pi 4 - I suppose that’s more complex than their “Green” but the complexity is just flashing an SD card.

You do understand correctly. The Home Assistant instance itself is the web hook endpoint. In Home Assistant, you create automations. Any given automation has a set of triggers and a set of actions. By simply saying that an automation should be triggered by a Web hook, Home Assistant assigns it a unique URL pointing at the Home Assistant instance. You can have as many as you want and they can all do whatever you want them to do.

1 Like