Integrating the Elgato Stream Deck with Rivendell Radio Automation

Elgato Stream Deck

The Elgato Stream Deck is pretty much a Swiss Army knife for sending commands to a computer.  The unit is mainly designed for gaming and live streaming and is prepackaged to support functions for Twitch, YouTube, Twitter and for how we have been using it here at REC, for controlling Open Broadcaster Software (OBS), a comprehensive, free, video management system designed for live streaming.  The Stream Deck is compatible with Windows 10 and macOS 10.13 or later.  At REC, we run it on Windows 10.

In this Rivendell integration, we are not going to actually try to connect it directly to Linux.  Instead, we are going to take advantage of the Apache web server and PHP.  

At REC, we run Rivendell on CentOS7 on standalone boxes that are used for no other purposes.  We statically assign our IP addresses for each box using addresses within our LAN IP space. Each Rivendell box is installed with an mAudio 1010LT multi-channel sound card and uses jack. We are able to monitor and control our Rivendell boxes using VNC from any Windows workstation.  The Stream Deck is installed on one of those workstations.   Our primary use for the Stream Deck is to allow us to manipulate the audio connections on the 1010LT in order to connect in a live source and to break away from the automation such as for emergencies such as earthquakes or to do live shows.  Unlike other stations, we do not have our Rivendell running as a pot on the board.  Instead, the Rivendell manages the audio chain and our board is behind it.

If you have Rivendell installed with CentOS 7, following the installation instructions at Paravel Systems, then you will likely already have Apache2 web server already installed.  The base installation does not give you PHP.  But there are places where you can find instructions to install PHP.  Note, if you have previously installed phpmyadmin in order to edit your SQL database, then you already have a PHP installation that is configured to work with Apache.  We note, that REC does use the older PHP 5.x in our systems in order to assure compatability with our legacy code.  For consistency, we also use PHP 5.x on our Rivendell boxes, but I do feel that PHP 7.x or 8.x would also work.  

The Rivendell integration takes advantage of Rivendell's macro carts and the use of the Rivendell Markup Language (RML) command EX, which can be used to execute macro carts from Rivendell's rmlsend GUI application or from the command line.

The first thing you need to do is make a PHP script that will be used to interface with the command line and be able to send the rmlsend commands.  On the Rivendell box running CentOS7 and Apache, look for the folder /var/www/html and go there (or from command line: cd /var/www/html). 

Once you there there, use your favorite text editor (even if it is vi, although we prefer nano), and create a file called rml.php.  In that file you can put in the following code:

<?php
    $cart = $_GET['cart'];
    $psw = $_GET['psw'];

    if($cart > 950000 && $cart <= 950999 && $psw == "password")
    {
        exec("rmlsend EX\\ $cart!");
    }
?>

At REC, our macro cart numbers are in the range of 950000~950999.  We use the if statement to limit queries to this space to prevent unwanted actions in the event that the wrong cart number is passed.  Even though your Rivendell webserver should always be behind the firewall and not visitble to the world, the variable $psw in the if statement carries a simple static hardcoded password.  You can adjust the range of cart numbers and the password in the if statement. 

With this script in place you can now send commands to your Rivendell using HTTP to execute macro carts. 

Next, you may want to build your macro carts to do what you want them to do.  We are not going to get into a huge discussion on macro carts or RML here.  There is a ton of information about this in the Rivendell Operations Guide PDF that ships with Rivendell during the installation and is likely a desktop shortcut on your Rivendell box.

Now, let's say, the LAN IP address for your Rivendell box is 10.0.0.112, you can now send a command to your Rivendell by going to any computer on the same LAN and using a web browser to go to:

http://10.0.0.112/rml.php?psw=[password]&cart=[cart number]

Now, we need to make this work with the Stream Deck.  Open up the Stream Deck software on the computer equipped with the Stream Deck hardware:  

Find an open space on your Stream Deck where you want to define the button that you want to use:

On the right side of the Stream Deck app, you will see an option called "Website" (it will be under the header of "System").  Click on "Website" and drag it to the button you want to program.  Once you do that, then you will need to do the following:

  1. Type in the title for the button that you want displayed on the Stream Deck.
  2. Enter in the specific URL to reach your PHP script we already built, using the cart number as the cart parameter and the hardcoded password you set as the psw parameter.
  3. Put a check in the option "Access in Background".

That's It.  Now, when you push that button on the Stream Deck, Rivendell will launch that macro cart.   If a web browser appears after you push the button, make sure that the "Access in Background" option is checked.  If you check it, then a web browser does not open, thus giving this a smooth experience.  

In our testing of this, we have not noticed any delay from the time that the button is pushed to the time that the cart is executed.  

We hope this works out for you and allows you to better control your station/stream.