Category Archives: Hacks

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:

indigo.device.create(protocol=indigo.kProtocol.Plugin,
    address="F8",
    name="Device Name Here", 
    description="Description Here", 
    pluginId="com.mycompany.pluginId",
    deviceTypeId="myDeviceTypeId",
    props={"propA":"value","propB":"value"},
    folder=1234)

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.

Six hacks from 5 grams of Sugru

If you’re not familiar with Sugru, you should be.  It’s a moldable rubber compound that can be formed into any shape and cures at room temperature.  Sugru is amazing stuff.

Sugru comes in little 5 gram pouches in various colors (which can be blended together to create new colors).  The contents of each pouch needs to be used pretty much immediately after opening so I always try to batch my hacks/repairs to utilize a full pouch.  This might be my personal best–six objects improved with one pouch of Sugru!

IMG_1420

This otherwise lovely set of fish plates had rough, scratchy bottoms.

IMG_1419

IMG_1421

A few rubber feet later, problem solved!  Tip:  after forming each rubber foot, place the object right side up on a piece of waxed paper and press lightly to flatten and level the feet.  The waxed paper will peel off easily after the Sugru cures (around 24 hours).

IMG_1422

Same problem and same solution for this nice Spanish platter.

IMG_1425

Now what to do about about an otherwise perfect place to keep a bedroom clock radio?  (The problem is that it isn’t possible to see the “alarm off” button without getting out of bed and kneeling down.)

IMG_1424

Well, let’s just add a nub of Sugru to the Off button and feel it instead!!

There you go.  Six objects improved for an investment of a few minutes time and under a gram of Sugru each.

-Jim