{"id":115,"date":"2013-10-07T15:12:27","date_gmt":"2013-10-07T20:12:27","guid":{"rendered":"https:\/\/jimandnoreen.com\/?p=115"},"modified":"2013-10-07T15:12:27","modified_gmt":"2013-10-07T20:12:27","slug":"importing-radiora-2-devices-into-indigo","status":"publish","type":"post","link":"https:\/\/jimandnoreen.com\/?p=115","title":{"rendered":"Importing RadioRA 2 devices into Indigo"},"content":{"rendered":"<p>In a <a title=\"An Indigo plugin for Lutron RadioRA 2\" href=\"https:\/\/jimandnoreen.com\/?p=96\">recent post<\/a>, I wrote about a plugin I made for <a title=\"Indigo\" href=\"http:\/\/www.perceptiveautomation.com\/indigo\/index.html\" target=\"_blank\">Indigo<\/a> to add support for Lutron RadioRA 2 devices.\u00a0 I can&#8217;t say enough good things about this software.\u00a0 It&#8217;s rock solid reliable and extremely flexible.\u00a0 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&#8217; presence by looking for their cellphones on the wifi network.<\/p>\n<p>So it got to be time to add the 80+ RadioRA 2 devices in the house to Indigo&#8217;s database.\u00a0 Although this\u00a0would be\u00a0a one-time task, I really dreaded the drudgery of typing in all those device names and properties.\u00a0 So I fetched the device database from the RadioRA 2 main repeater (at http:\/\/[Repeater IP Address]\/DbXmlInfo.xml).\u00a0 This produces an XML file with complete information about the RadioRA 2 installation.<\/p>\n<p>Indigo allows devices to be added to its database programatically.\u00a0 The Python syntax looks like this:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>indigo.device.create(protocol=indigo.kProtocol.Plugin,\r\n    address=\"F8\",\r\n    name=\"Device Name Here\", \r\n    description=\"Description Here\", \r\n    pluginId=\"com.mycompany.pluginId\",\r\n    deviceTypeId=\"myDeviceTypeId\",\r\n    props={\"propA\":\"value\",\"propB\":\"value\"},\r\n    folder=1234)<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>So far so good.\u00a0 My original plan was to use Python to parse the XML file and create the devices.\u00a0 So I cracked open Mark Lutz&#8217;s excellent reference book <em><a title=\"Learning Python\" href=\"http:\/\/www.amazon.com\/gp\/product\/1449355730\/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449355730&amp;linkCode=as2&amp;tag=therat00-20\" target=\"_blank\">Learning Python<\/a>.<\/em>\u00a0 Despite Lutz&#8217;s clear examples, I just couldn&#8217;t get the XML file to parse.\u00a0 (It turned out to be an issue with the XML file itself).<\/p>\n<p>Not wanting to invest too much time writing a program I&#8217;d only use once, I came up with a different approach.\u00a0 If I could extract the XML data into an Excel friendly format, I knew I&#8217;d be able to cobble together the Python code I needed for Indigo.\u00a0 I found this awesome <a title=\"XML to Excel\" href=\"http:\/\/www.luxonsoftware.com\/converter\/xmltoexcel\" target=\"_blank\">online XML to Excel conversion tool<\/a>\u00a0but it threw an error when I tried to upload the XML file.<\/p>\n<p>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).\u00a0 Something didn&#8217;t look right.\u00a0 The node &#8220;Areas&#8221;\u00a0was defined twice.\u00a0 WTF?\u00a0 So I trimmed everything from the top of the file to just before the second &#8220;&lt;Areas&gt;&#8221; tag.\u00a0 Then I jumped to the bottom of the file and trimmed everything after the first &#8220;&lt;\/Areas&gt;&#8221; tag.\u00a0 Voila!\u00a0 The file was processed by the online conversion tool and it returned a nicely formatted Excel workbook.<\/p>\n<p>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.<\/p>\n<p>If you&#8217;d like to use this technique, take a look at the Excel Spreadsheet that I posted <a title=\"Indigo Import Spreadsheet\" href=\"https:\/\/jimandnoreen.com\/?attachment_id=114\">here<\/a>.\u00a0 It should be self-explanatory but give me a shout if you get stuck.\u00a0 Copy the results from column H of the first tab and paste into Indigo&#8217;s scripting shell.\u00a0 You should name all of your areas\/rooms in Indigo&#8217;s devices tab prior to importing your devices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a recent post, I wrote about a plugin I made for Indigo to add support for Lutron RadioRA 2 devices.\u00a0 I can&#8217;t say enough good things about this software.\u00a0 It&#8217;s rock solid reliable and extremely flexible.\u00a0 Among other things, I have Indigo set up to email a picture to me when somebody comes up [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[8,12,31],"tags":[34,32,33],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8sNNV-1R","jetpack-related-posts":[{"id":96,"url":"https:\/\/jimandnoreen.com\/?p=96","url_meta":{"origin":115,"position":0},"title":"An Indigo plugin for Lutron RadioRA 2 and Caseta","date":"September 25, 2013","format":false,"excerpt":"Lutron got a lot of things right with its RadioRA 2 lighting control system. \u00a0There are over 25 device types, including dimmers, thermostats, shades, keypads, and handheld controls. \u00a0The switches work equally well in new construction and retrofit applications. \u00a0Wireless communication is robust and the device build quality is flawless.\u2026","rel":"","context":"In &quot;Electrical&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":211,"url":"https:\/\/jimandnoreen.com\/?p=211","url_meta":{"origin":115,"position":1},"title":"Controlling devices with Indigo and Amazon Echo (Alexa)","date":"March 5, 2016","format":false,"excerpt":"A recently added plugin for the superb\u00a0\u00a0Indigo Smart Home Software platform\u00a0enables voice control of devices like lights, thermostats, fans, shades and garage doors--to name just a few--via an Amazon\u00a0Echo Dot,\u00a0Echo\u00a0or Fire TV. \u00a0It works seamlessly with the Lutron RadioRA 2 plugin that I developed and is also presumed compatible with\u2026","rel":"","context":"In &quot;Electrical&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":136,"url":"https:\/\/jimandnoreen.com\/?p=136","url_meta":{"origin":115,"position":2},"title":"Vehicle detection using iAutomate RFID","date":"December 24, 2013","format":false,"excerpt":"One item on my to-do list for a long time was to enable our home automation system to detect the comings and goings of our vehicles. \u00a0Each has an EZ-Pass badge, so I figured slam-dunk, just find an appropriate active RFID reader and we're done. \u00a0But I was unable to\u2026","rel":"","context":"In &quot;Apple&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":356,"url":"https:\/\/jimandnoreen.com\/?p=356","url_meta":{"origin":115,"position":3},"title":"Long Distance Mailbox Alert using LoRa","date":"October 28, 2020","format":false,"excerpt":"You've got mail! An IoT project using solar power and long range radio In these pandemic times of limited mobility, I become more like a dog every day: looking forward with great enthusiasm to meals, walks and car rides. One of the daily events that's taken on new importance is\u2026","rel":"","context":"In &quot;Arduino&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jimandnoreen.com\/wp-content\/uploads\/2020\/10\/img_5468-scaled.jpg?fit=1200%2C821&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":142,"url":"https:\/\/jimandnoreen.com\/?p=142","url_meta":{"origin":115,"position":4},"title":"Switching between HDMI and analog audio on a Mac","date":"February 13, 2014","format":false,"excerpt":"Here's a proven fix if you need both analog and HDMI audio outputs and require a way of switching between them. \u00a0In my case, I had an application where a rack mounted Mac Mini serves as both a media server and an audio source for a whole house paging system.\u2026","rel":"","context":"In &quot;Apple&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":89,"url":"https:\/\/jimandnoreen.com\/?p=89","url_meta":{"origin":115,"position":5},"title":"Two highly recommended wifi routers","date":"September 26, 2013","format":false,"excerpt":"Over the years I've implemented several wifi solutions in larger commercial and residential settings, sometimes replacing existing equipment to improve coverage. After much experimentation, trial and error, and sometimes frustration, I now recommend wifi equipment from only two manufacturers: Ubiquiti Networks and Amped Wireless. But before we go into that\u2026","rel":"","context":"In &quot;Networking&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/posts\/115"}],"collection":[{"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=115"}],"version-history":[{"count":5,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/posts\/115\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=\/wp\/v2\/posts\/115\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jimandnoreen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}