Importing RadioRA 2 devices into Indigo

In a recent post, I wrote about a plugin I made for Indigo to add support for Lutron RadioRA 2 devices.  I can’t say enough good things about this software.  It’s rock solid reliable and extremely flexible.  Among other things, I have Indigo set up to email a picture to me when somebody comes up the driveway (but only when nobody is home; how cool is that!) and detect house occupants’ presence by looking for their cellphones on the wifi network.

So it got to be time to add the 80+ RadioRA 2 devices in the house to Indigo’s database.  Although this would be a one-time task, I really dreaded the drudgery of typing in all those device names and properties.  So I fetched the device database from the RadioRA 2 main repeater (at http://[Repeater IP Address]/DbXmlInfo.xml).  This produces an XML file with complete information about the RadioRA 2 installation.

Indigo allows devices to be added to its database programatically.  The Python syntax looks like this:

    name="Device Name Here", 
    description="Description Here", 

So far so good.  My original plan was to use Python to parse the XML file and create the devices.  So I cracked open Mark Lutz’s excellent reference book Learning Python.  Despite Lutz’s clear examples, I just couldn’t get the XML file to parse.  (It turned out to be an issue with the XML file itself).

Not wanting to invest too much time writing a program I’d only use once, I came up with a different approach.  If I could extract the XML data into an Excel friendly format, I knew I’d be able to cobble together the Python code I needed for Indigo.  I found this awesome online XML to Excel conversion tool but it threw an error when I tried to upload the XML file.

I opened the file with BBEdit and used the Tidy, Reflow Document from the Markup menu to make the unformatted XML more readable (you just gotta love BBEdit).  Something didn’t look right.  The node “Areas” was defined twice.  WTF?  So I trimmed everything from the top of the file to just before the second “<Areas>” tag.  Then I jumped to the bottom of the file and trimmed everything after the first “</Areas>” tag.  Voila!  The file was processed by the online conversion tool and it returned a nicely formatted Excel workbook.

After a bit of further manipulation in Excel (and one string concatenation function that will make your head swim), I had all the Python code generated.

If you’d like to use this technique, take a look at the Excel Spreadsheet that I posted here.  It should be self-explanatory but give me a shout if you get stuck.  Copy the results from column H of the first tab and paste into Indigo’s scripting shell.  You should name all of your areas/rooms in Indigo’s devices tab prior to importing your devices.

2 thoughts on “Importing RadioRA 2 devices into Indigo

  1. dan

    Thanks for making the radio ra2 plug-in. I have a lutron radio ra2 with 80 devices (in the process of adding sensors) and it is very limited, so your add-in will be solving many issues I have.
    One question:
    you support the RS232 to communicate with the Lutron repeater. Are you planing to support the ethernet one? It is extremely difficult for me to get an rs232 cable from my mac to the repeater (metal beams in the middle….) but the repeater is already connected to ethernet so if it was supported I have nothing to do.
    Is it a programming issue I could help with?
    Thanks again for a great plugin.

    1. ratranch Post author

      Adding ethernet connectivity is on the to-do list but at a very low priority. The best solution for users who desire to use existing CAT5/CAT6 wiring is to use an RS232 extender kit like this one. For short runs, there are also passive RJ-45 to DB9 adapters available.


Leave a Reply

Your email address will not be published. Required fields are marked *