Hello everyone. I'm new to this community but wanted to toss out this Custom Driver I've created for the iAqualink controller for pool/spa systems. I wanted to integrate the iAqualink into my Hubitat and wasn't terribly satisfied with the drivers I could find out there.
The driver is available on my Github and via HPM. I've created a fairly-detailed README in the repository, but I'll repeat some of that here.
Intro
This driver aims to bring all of the functionality provided by the iAqualink device/app into Hubitat. Some functionality was missing from existing drivers, and the representation of the devices was not always ideal (IMHO). I had the following goals when building out this driver:
- All status data available in the iAqualink mobile app should be available via the driver.
- The parent device of the driver should contain all status data as attributes to simplify gathering all pool/spa status into Node-Red in one shot.
- The pool and spa heater should be represented properly as Thermostat devices.
- The air, pool, and spa current temperatures should be represented properly as Temperature sensors.
- Support having multiple iAqualinks linked to the account (config option to pick which one to use)
- Account username/password should be the only necessary config to get started (pull device serial number via api)
- Customizable auto-refresh time interval
- Minimize API calls where possible including reusing logged in session as long as possible
- Customizable number of Aux Devices and OneTouch setups (I doubt many real users are using all of their aux devices or OneTouch slots.)
- Customizable temperature units (F, C, or follow the hub's setting)
- Uncluttered attributes (internal values held in state and attributes reserved for user-facing values useful for control/automation)
- Good quality logging, preference, descriptions, etc for a good user experience
Overview
The driver creates a parent "iAqualink" device which provides no capabilities other than initialize to create the child devices. However, this parent device has attributes for all of the available data within the driver. This makes it an excellent choice to use via Maker API in other tools (e.g. Node-Red) to obtain a complete picture of your entire system from a single node.
The main filter pump, auxillary devices (e.g. spa jets, booster pumps, etc.), and OneTouch setups are setup as simple Switch (on/off) child devices. The switch for Spa mode and for a solar heater are also created as Switch child devices if enabled in preferences. The parent device has attributes for the current air, pool, and spa temperatures, but they can also be made available as Temperature sensor child devices via the preferences. Color-supporting lights are also supported at a very basic level (see Limitations below).
The pool and spa heaters (both if enabled in preferences) are created as Thermostat child devices. They correctly report mode, operating status, current temperature, and setpoint. Controlling them works like controlling any other Thermostat device to disable/enable the heater or set the target temperature. They will automatically enter the "emergency heat" mode if freeze protection is active on the Aqualink. For operating status, they report "idle" when the heater is disabled and either "pending heat" or "heating" while it is enabled based on whether or not the heater is actively running.
Limitations
My system does not have any of the following so I am unable to build or verify this functionality:
- Variable Speed Pumps (VSP)
- Dimmable Lights
- Color Lights (included based on an existing Aqualink driver but I cannot verify functionality and can't build out proper color-based capabilities for them)
Special Thanks
- Mike Coffey for his Aqualink driver that simplified working out the API calls.
- Dan Cunningham for his openHAB iAqualink addon which also helped me better understand the API calls.
- Patrick Rigney for his Venstar ColorTouch Hubitat driver that helped me learn a lot about writing Hubitat drivers and to better understand the Thermostat capability.
I'm happy to hear any questions/comments/complaints or other feedback about the Driver. To anyone who goes diving into the code, note that this is my first time writing a Hubitat driver, and my first time with Groovy (and it's been ages since I used Java). There's a lot of explicitness in the code which is probably not very Groovy-like because I like to squash the warnings I get from IntelliJ. If you actually read all of this, what's wrong with you? Thanks.