Writing my own Plugin: Integrating the Pool

I outlined in the Control Software post that Indigo now has the ability to use plugins to extend its control and functionality. Additionally, those plugins can be user written. Some users had already written plugins to integrate with some things in my house (Elk M1G alarm, for example) but it was becoming clear that for some things I was going to need to figure out how to write my own plugins.

After being in the house for a year, we had a pool built. The pool builder used Pentair equipment throughout and included their IntelliTouch (automation) system. This is basically a computer controlled management system for all of the pool equipment. It handles all scheduling and logic for pool operations and has a hand held controller to control it all.


Now to me, part of having a home automation system with remote access is being able to do things like land at the airport after a long flight, and start up the spa so that it is heated when I get home (as opposed to drivng all the way home and then having to wait for the spa to heat up). Pentair offers a solution to this, but it requires the purchase of an extra module and uses their own iPhone app. I'd rather keep everything automation related within the confines of the iPhone app I already use (Indigo Touch). Another thing Pentair offers is a serial interface to the IntelliTouch system to allow a computer to talk to it. All I had to do now was figure out how to write a plugin. Easy, right?


Ok, so writing a plugin is probably easy if you're a programmer, but I most certainly am not. I took one 3 credit course in college, and have written a few simple Excel macros. I would really call myself comfortable with scripting, not programming. Why would I do this?


Well, after looking into this, it seemed like it wasn't so bad. I downloaded the guide to the Pentair Serial Adapter which included the serial communication protocol. This is basically the guide of what you need to type to tell the pool system to do something, and what it says on the serial port when it does something. For example; to turn on the spa, you send the command "#SPA=1<cr>", and when the pool is telling you the temperature is 59 degrees, it says "!00 POOLTMP=59<cr>". I feel I would be pretty comfortable using some sort of scripting language to parse those commands into what they mean, as well as send commands for what I want to do.


There is also a handy guide for how to write a plugin on Perceptive Automation's website. This basically shows you how a plugin works and communicates with Indigo. Plugins are written in Python (which I know absolutely nothing about), but I looked at a few Python guides online. Still, this is nowhere near enough to get you going. The final necessary pieces were examples. The Indigo plugins are compiled at startup, and so the code is distributed with each plugin. That lets you open up a plugin and see how it was written. This is super handy (plus Indigo comes with a few plugins of its own, some of which communicate with serial devices, so I had a good base to work on). There are also some helpful support forums which were really helpful in getting me past a few blocks.


That being said, it still wasn't 'easy'. I basically bashed my head into the Indigo Plugin Guide and examples for ever with nothing making sense, until it all 'clicked'. However, in the end, the plugin got written. There is still a minor hiccup when first configuring the plugin that requires you to configure the plugin, and then reload the plugin, but frankly, with myself being the primary user, I find the return-on-effort to correct this problem far too small to correct right now. I've been running the plugin for almost a year and it is rock solid after it's configured.


The plugin does two main things: Allows me to be in control of almost all aspects of pool operation, and also Indigo to be updated on pool operations. The main pump control and scheduling remains in the hands of the Pentair Intellitouch computer (as I feel it is less likely to crash or something than my computer) but it updates Indigo on what pumps are running, what pool temperatures are, etc... In addition, I can use Indigo to control the pool and other elements that the Intellitouch system controls (spa, pool and spa lights, fire pit, water feature, etc...).


The only remaining challenge was actually connecting the computer to the pool, which I will cover in a later post.


You can download the plugin on the Downloads page.

Comments: 0 (Discussion closed)
    There are no comments yet.