Pentair EasyTouch control via Autelis & scripts

Posted on
Mon Apr 09, 2018 2:42 pm
ar26pt2 offline
Posts: 19
Joined: Jan 23, 2014

Pentair EasyTouch control via Autelis & scripts

I cobbled together some scripts to control my Pentair Pool using the Autelis interface. I have not yet tried Swancoat's plugin http://forums.indigodomo.com/viewtopic.php?f=134&t=9869. This basically accesses the relavent xml files from the autelis device and parse's the data into variables. Then a control page displays it for me. Its a little clunky because I'm using variables to track everything. Then can post HTTP commands to the autelis device to activate certain circuits or make certain changes, waits a minute and run this query again to see if my commands stick. Forgive me I'm not a coder! My pool is simple: var speed filter pump, polaris pump, salt cell. For whatever reason the Autelis is kinda glitchy and so I have scripted commands to post a couple times, because first time doesnt always stick (dont know if that is an easytouch issue or autelis issue).
I do not use Indigo for primary programming or control of the pool but use it to adjust the salt cell output or turn pumps on for off-hours swim/cleaning, and have the polaris cleaner run an extra 2 hours on rainy days (=leaves). Nice to see water temp also. Also linked some simple pump on/off commands to my Alexa which makes a midnight swim easy to voice activate.
Code: Select all
indigo.server.log('Performing routine query for status', type='Autelis')
import urllib, datetime
ip = str((indigo.variables['poolURL'].value))  #pool url stores LAN ip and username/password of autelis
try:
 #status.xml
 statusxml = urllib.urlopen(ip+'status.xml', proxies={})
 status = statusxml.read()
 statusxml.close()
 #runstate
 s=status.find('<runstate>')
 e=status.find('</runstate>')
 runstate = status[s+10:e]
 if float(runstate)==50: runstate = "Panel is CONNECTED/READY"
 else: runstate="Panel is NOT READY"
 #opmode
 s=status.find('<opmode>')
 e=status.find('</opmode>')
 opmode = status[s+8:e]
 if float(opmode)==1: runstate = "SERVICE MODE/CANNOT CONTROL"
 #time
 s=status.find('<time>')
 e=status.find('</time>')
 time = str(status[s+6:e])
 time = datetime.datetime.fromtimestamp(int(time)).strftime('%m-%d %H:%M:%S')
 runstate=runstate+' @ '+ str(time)
 #circuit6 - POOL FILTER  CIRCUIT
 s=status.find('<circuit6>')
 e=status.find('</circuit6>')
 circuit6 = status[s+10:e]
 if circuit6 == "0": circuit6 = "false"
 else: circuit6 = "true"
 #circuit3 - BOOSTER/ROBOT  CIRCUIT
 s=status.find('<circuit3>')
 e=status.find('</circuit3>')
 circuit3 = status[s+10:e]
 if circuit3 == "0": circuit3 = "false"
 else: circuit3 = "true"

 #pooltemp
 s=status.find('<pooltemp>')
 e=status.find('</pooltemp>')
 pooltemp = status[s+10:e]
 pooltemp = str(pooltemp)+"F"

 if str(circuit6) == 'true': indigo.variable.updateValue('poolTemp', str(pooltemp))
 indigo.variable.updateValue('poolCircuit3', str(circuit3))
 indigo.variable.updateValue('poolCircuit6', str(circuit6))
 indigo.variable.updateValue('poolTimeStamp', str(time))
 indigo.variable.updateValue('poolRunState', str(runstate))

except: indigo.variable.updateValue('poolRunState', 'COM ERR (status.xml)')
try:
 #PUMP.XML
 Pumpxml = urllib.urlopen(ip+'pumps.xml', proxies={})
 #time.sleep(.5) #wait for the url to load up
 pumps = Pumpxml.read()
 Pumpxml.close()

 #trim out
 s=pumps.find('<pump1>')
 e=pumps.find('</pump1>')
 pump1 = pumps[s+7:e]

 watt,rpm,err = pump1.split(',')
 if float(rpm) >0: st="true"
 else: st="false"
 watt = watt + 'W'
 if float(rpm) > 0: rpm='MAIN PUMP ON @ '+str(rpm)+'rpm'+'/'+str(watt)
 else: rpm='MAIN PUMP OFF'
 if float(err)==0: err = '(no errors)'
 else:
    err='WITH PUMP ERROR!!'
    indigo.server.log('Pool has PUMP ERROR!', type="Autelis", isError=True)
 rpm = rpm+' '+str(err)
 indigo.variable.updateValue('poolPUMPstate', st)
 indigo.variable.updateValue('poolPUMPwatt', watt)
 indigo.variable.updateValue('poolPUMPrpm', rpm)
 indigo.variable.updateValue('poolPUMPerr', err)
 #time.sleep(1)
except: indigo.variable.updateValue('poolRunState', 'COM ERR (pumps.xml)')
try:
#CHEM.XML
 chemxml = urllib.urlopen(ip+'chem.xml', proxies={})
 #time.sleep(1) #wait for the url to load up
 chem = chemxml.read()
 chemxml.close()
 s=chem.find('<salt>')
 e=chem.find('</salt>')
 salt = chem[s+6:e]
 #salt = float(salt)
 salt = int(salt)*50
 indigo.variable.updateValue('poolSalt', str(salt))
 #poolchlrSP
 s=chem.find('<poolsp>')
 e=chem.find('</poolsp>')
 poolChlSP = chem[s+8:e]
 indigo.variable.updateValue('poolChlSP', str(poolChlSP)+'%')
 #poolChlorEn
 s=chem.find('<chloren>')
 e=chem.find('</chloren>')
 poolChlorEn = str(chem[s+9:e])
 if poolChlorEn == '1': indigo.variable.updateValue('poolChlorEn', 'true')
 else:indigo.variable.updateValue('poolChlorEn', 'false')
 #poolChlorErr
 s=chem.find('<chlorerr>')
 e=chem.find('</chlorerr>')
 poolChlorErr = int(chem[s+10:e])
 if poolChlorErr == 1: indigo.variable.updateValue('poolChlorErr', 'LOW FLOW')
 if poolChlorErr == 0: indigo.variable.updateValue('poolChlorErr', 'CHLORINATOR OK')
 if poolChlorErr > 1: indigo.variable.updateValue('poolChlorErr', 'OTHER ERR')
 if poolChlorErr == 64: indigo.variable.updateValue('poolChlorErr', 'LOW TEMP/OFF')
 #poolSuperHrs
 s=chem.find('<super>')
 e=chem.find('</super>')
 poolSuperHrs = str(chem[s+7:e])
 if poolSuperHrs == '0': poolSuperHrs = 'super chlorinate off'
 else: poolSuperHrs = 'SUPER CHLOR ON x '+poolSuperHrs+' more hour(s)'
 indigo.variable.updateValue('poolSuperHrs', poolSuperHrs)



except: indigo.variable.updateValue('poolRunState', 'COM ERR (chem.xml)')


example turning a pump on:
Code: Select all
import urllib
ip = str((indigo.variables['poolURL'].value))
ip = ip+'set.cgi?name='
try:
 cmd = urllib.urlopen(ip+'circuit6&value=1', proxies={})
 confirm = cmd.read()

 if float(confirm) == 1:indigo.variable.updateValue('poolConfirmCmd',"POOL ON REC'd")
 else: indigo.variable.updateValue('poolConfirmCmd','NOT ACKNOWLEDGED')
except: indigo.variable.updateValue('poolConfirmCmd','COM ERR')


note to make it more fun my pump is 100feet from the house. I have a UniFi outdoor wifi antenna on the garage. I put a waterproof housing hosting a TPLINK wifi in bridge mode that connects the autellis (also in the waterproof housing). The tplink pings my router every few minutes and reboots when it loses connection. Indigo pings the tp-link also and reports to me if down every couple hours. Somehow this all works pretty good.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest