Smartapp/device types for Autelis Pool Controller

Greetings all, I’m attempting to develop a device handler and smartapp for my swimming pool controller (Autelis). I am able to successfully connect to my controller and return the content I need, however the XML formatting seems to be stripped (at least in the IDE). I’m new to groovy so I’m having issues with the correct object type needed for XMLSlurper to work properly. I have exhaustively searched this forum, groovy forums, you name it I I can’t figure out why I’m struggling to bring such basic XML data into my device handler. I would really appreciate some feedback from you, the experts on what I’m doing wrong. Below is a basic snippit of the relevant code,

def params = [
uri: "http://XXXX:XXXX@MYEXTERNALIP:8080/status.xml",
contentType: 'text/xml']

try {
httpGet(params) { resp ->

//log header data
resp.headers.each {
log.debug "${it.name} : ${it.value}"}

//log raw data
log.debug resp.data.text()

//log payload data by node
resp.data.children().each {

// by name and value
log.debug "${it.name} : ${it.value}" }

//log XMLParser result
def body = new XmlParser().parseText(resp.data.text())
body.system(0).children().each {
log.debug "${it.name} :: ${it.value}"}

//log XMLSlurper result
def body2 = new XmlSlurper().parseText(resp.data.text())
body2.system(0).children().each {
log.debug "${it.name} ::: ${it.value}"}

}
} catch (e) {
log.error "something went wrong: $e"
}

Here is the console data:

ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: error something went wrong: java.lang.NullPointerException:          Cannot invoke method text() on null object
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug :
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug :
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug :
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug 512001.0.11149037683900000100000000719872F
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug Cache-Control : no-cache
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug Content-Type : text/xml
ad81be5b-d0f9-4e2e-ba24-49f6075de655 1:33:59 PM: debug Connection : close

The raw XML returned fro my device looks like this (I have no control over this content):

<response>
<system>
	<model>512</model>
	<opmode>0</opmode>
	<err>0</err>
	<version>1.0.11</version>
	<time>1490376350</time>
</system>
<equipment>
	<pump>0</pump>
	<spa>0</spa>
	<waterfall>0</waterfall>
	<valve3>0</valve3>
	<poolht>0</poolht>
	<valve4>1</valve4>
	<aux1>0</aux1>
	<aux2>0</aux2>
	<aux3>0</aux3>
	<aux4>0</aux4>
	<aux5>0</aux5>
	<aux6>0</aux6>
	<aux7>0</aux7>
	<aux8></aux8>
	<aux9></aux9>
	<aux10></aux10>
	<aux11></aux11>
	<aux12></aux12>
	<aux13></aux13>
	<aux14></aux14>
	<aux15></aux15>
	<schlor>0</schlor>
</equipment>
<temp>
	<pooltemp>71</pooltemp>
	<spatemp>98</spatemp>
	<airtemp>72</airtemp>
	<solartemp></solartemp>
	<tempunits>F</tempunits>
</temp>
</response>
1 Like

Any progress with the autelis device handler? I have the same unit and want to integrate it as well.

Yes I have it working pretty well. I will post my code tonight when I get home.

MB

I am stoked to get my hands on it!!! Thanks in advance for doing all the work.

Here are some renderings of how my device handler works. I really made this quickly to fit my needs so there are huge opportunities to improve the functionality. One limitation of my implementation is that it requires the Autelis controller to be accessible from the internet (I used port forwarding on my home internet router and exposed the Autelis on port 8080). It appears that there is a relatively straightforward way to adjust the code to have it run from the smarthub directly rather than the internet servers (removing the need for external IP access to the autelis) but I just never got to it. I’m going to figure out how to post the code now.

There are three total devicetypes needed:

There is one smartapp needed:

1 Like

my xml looks a bit different

going to work with your code to see if i can get it to work and then maybe we can make a one size fits all for

	<runstate>50</runstate>
	<model>13</model>
	<haddr>1</haddr>
	<opmode>0</opmode>
	<freeze>0</freeze>
	<sensor1>0</sensor1>
	<sensor2>0</sensor2>
	<sensor3>0</sensor3>
	<sensor4>0</sensor4>
	<sensor5>0</sensor5>
	<version>1.6.7</version>
	<time>1516383533</time>
</system>
<equipment>
	<circuit1>0</circuit1>
	<circuit2>0</circuit2>
	<circuit3>0</circuit3>
	<circuit4>0</circuit4>
	<circuit5>0</circuit5>
	<circuit6>0</circuit6>
	<circuit7>0</circuit7>
	<circuit8>0</circuit8>
	<circuit9>0</circuit9>
	<circuit10></circuit10>
	<circuit11></circuit11>
	<circuit12></circuit12>
	<circuit13></circuit13>
	<circuit14></circuit14>
	<circuit15></circuit15>
	<circuit16></circuit16>
	<circuit17></circuit17>
	<circuit18></circuit18>
	<circuit19></circuit19>
	<circuit20>0</circuit20>
	<feature1>0</feature1>
	<feature2>0</feature2>
	<feature3>0</feature3>
	<feature4>0</feature4>
	<feature5>0</feature5>
	<feature6>0</feature6>
	<feature7>0</feature7>
	<feature8>0</feature8>
	<feature9></feature9>
	<feature10></feature10>
</equipment>
<temp>
	<poolht>0</poolht>
	<spaht>0</spaht>
	<htstatus>0</htstatus>
	<poolsp>80</poolsp>
	<spasp>96</spasp>
	<maxplsp></maxplsp>
	<pooltemp>40</pooltemp>
	<spatemp>40</spatemp>
	<airtemp>55</airtemp>
	<soltemp></soltemp>
	<tempunits>F</tempunits>
	<htpump>0</htpump>
</temp>

***Note there is also a to open the file and a as well for some reason it wouldnt let me cut and paste with those in there???

My autelis is for Heyward controllers, probably the XML varies based upon your main controller brand. I believe it wouldn’t be too hard to remap the code for your specific XML output. Obviously you’ll need to discover what each circuit field represents and then remap accordingly. Feel free to post any issues you run into here and I’ll take a shot at helping where i can.

Good luck! (It’s totally worth the work by the way)

I was thinking the ideal way to make this is to make it more customizable when you install it, but im not sure thats worth the work for either of us.

I have the gen 1 smartthings hub and the pentair easy touch 8

I keep getting this error “something went wrong: java.lang.reflect.UndeclaredThrowableException”

After a quick google it seems to have to do with the unschedule() command.

Not sure if being gen1 vs gen 2 matters - also i just put in my local ip which is not forwarded to the internet. This shouldnt matter I dont think, I was able to toggle things on and off using a local ip just not get the device status.

it’s possible to use a local IP but there is much more code needed if that’s the plan (to make the hub execute the routines locally versus on their server.

i don’t know if gen1 v gen2 will matter, do you know what line is throwing that error?

Unfortunately it didnt give any additional info just that error over and over

Jon have you had any luck getting it going on your easy touch?

So, I was able to install everything. Currently, I am on the second generation hub and I am utilizing the Easy touch by pentair like Jon. The temperature doesn’t register the temperature and some the switches need to be reordered. I am guessing I need to reorder the code to match the it up for easy touch. Like was mentioned in a previous post.