Autelis Pool Control and Vera

i guess first we want to figure out at which point in the process it is failing, so a few questions are:

  1. is your variableContainer device updating when your pool status changes? (change the pool heat set point on your Jandy one touch and confirm autelis sees the change, then reload your web browser on UI5 and see if variable 1 in your variable container device updated. then turn your pool pump on or off, confirm autelis updated and check Variable11 in your variable container to make sure it updated).

  2. when you issue an http command to autelis from vera (i like using LuaTest for this sorta testing) does autelis do what it should?

eg: does this turn off your pool heat

local vCode, vData = luup.inet.wget("http://<autelis_ip>/set.cgi?name=poolht&value=0",5,"<autelis_username>","<autelis_password>")
  1. if you test a line of code to set the state of a multiswitch button, does it do that correctly?

eg: does this turn on button 5 on your multiswitch?

     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus5",{newStatus5=1},218)

and does this turn button 5 off?

     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus5",{newStatus5=0},218)

if all that is working, then next step is to put some logging into the startup lua functions to see if they are being called when variable container variables change and when multiswitch buttons are turned on or off. if you use eventwatcher then add a user log item to it, if note then just luup.log with a prefix, and ssh into vera and 'tail -f /var/log/cmh/LuaUPnP.log | grep autelis" to confirm the functions are being called when you turn things on/off on your jandy. for example:

in the update spa pump switch function add a log line e.g.:

[code]-- update spa pump switch
function f_watch_spapump(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)

luup.log("autelis update spa pump switch - new value is ".. lul_value_new)

 luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus3",{newStatus3=lul_value_new},218)
 f_SetPoolStatusOnline()

end
luup.variable_watch(“f_watch_spapump”,“urn:upnp-org:serviceId:VContainer1”,“Variable12”, autelis_vc)
[/code]

and e.g. does the update spa jets function get called when you turn button 5 of your multiswitch on or off:

[code]-- update spa jets
function f_watch_spajetSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)

luup.log("autelis update spa jets when multiswitch button is pressed - new value is ".. lul_value_new)

local vURL =“http://”…autelis_ip…“/set.cgi?name=aux1&value=”… lul_value_new

luup.log("autelis update spa jets when multiswitch button is pressed - vURL is “… vURL…” user is "… autelis_user… " passwd is "… autelis_passwd)

local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spajetSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status5’,218)
[/code]

if all of that is working and the url, username and password in the log are correct then we need to keep digging. if any of that is not working then we know where to focus.

Thanks so much for helping troubleshoot this with me.

    • the variable container updates immediately when changes are made from a one touch.
    • Variable11 does not update when turning the pump on/off
    • your pool heat test works.
    • Yes, button five activates when running that code.
    • Yes, button five deactivates when running that code.

I don’t have eventwatcher installed. I’ll get that loaded and test the remainder of your steps first thing in the morning and post back the results.

If you have any suggestion about Variable11 not updating I can test that in the morning too.

Again, thanks for your help.

Tom

1. - the variable container updates immediately when changes are made from a one touch. - Variable11 does not update when turning the pump on/off

oops, i meant Variable10 should update on the pump on/off… so it sounds like that is not the problem

let’s see what the logging tells us. maybe the functions are not getting called (you have them all in your Startup Lua not inside any other block of code, right?) or perhaps there is something in the variables… hopefully the logging will illuminate. you can use luup.log to log to the vera log file without installing eventwatcher or once you get event watcher working you would use something like

local url = require "socket.url" local vLogMe = "autelis update spa jets when multiswitch button is pressed - new value is ".. lul_value_new.." vURL is ".. vURL.." user is ".. autelis_user.. " passwd is ".. autelis_passwd) luup.inet.wget ("http://127.0.0.1:3480/data_request?id=lr_EventWatcher&event=" ..url.escape(vLogMe))

OK, I didn’t get a chance to work on this yesterday. I go to work on it this morning and now everything works as designed. No changes on my part. Absolutely bizarre.

Thanks again for putting this all together MDA. It works great.

Tom

Magic ! :slight_smile:

Sent from my iPhone using Tapatalk

mda - I really appreciate you posting this code. I took it and modified it for my Hayward (mainly changing variable mappings and dropping the thermostats which aren’t supported with the Hayward) and it works great. Thank you!

I’m a newby to Vera. Bought the vera lite a couple of weeks ago. It came with ui7 and then it upgraded to the latest firmware a week or so ago. I just have the basics - scenes with lights etc. I wanto add pool control, so I purchased an autelis for a Pentair intellitouch. I’m confused about the variable container. I created a variable container in vera and it shows 5 variables (Device #37). Is autelis supposed to automatically add all 20 something variables when it runs? Is the username and password I give autelis my micasaverde login/pw or the root/pw for the vera lite? I know I have the ip address right since I can SSH into the vera lite. I’m sure it ois something simple, but being a newby I just haven’t seen the light yet.

The plug in only updates the variables when they change so they will be slowly added to the container as the variables are updated.

Thanks! I guess I need to be more patient!

Hi all. I’m new to Vera and in the process of setting up my VeraEdge. Like cabs, I’m trying to add pool control for my auteuils for a Pentair intellitouch (probably not the best project to tackle as my first…). I’ve created the virtual devices in mda’s code and adding a variable container plugin. I’ve changed the code to reflect my device ids, user/pswd and ip address of my auteuils. I’ve tried using the “test luup code” in the Develop Apps section but it’s failing and not clear on how to begin troubleshooting. Any suggestions on how to start troubleshooting?

Update: I found the forum link for LuaTest and what a gem! It helped me make sure that my luup code changes are correct. It’s now successfully loaded in the startup lua. However, i don’t think the variable container is working correctly. I’ll keep searching, but if anyone has any pointers on were to look, let me know.

Still trying to get my Pool Control to work and slowly progressing… When I debug the XML “ping pool controller” code from earlier in this thread, i’m getting the following error:

“Ping Pool Controller.lua:52: attempt to call global ‘f_LogScene’ (a nil value)
stack traceback:
Ping Pool Controller.lua:52: in main chunk”

The section of code related to the line 52 in main chunk is the "f_LogScene(“Pool Control OFFLINE”):

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “LastPing”, os.date(‘%x %I:%M %p’), autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “OnlineStatus”, “OFFLINE”, autelis_vc)
f_LogScene(“Pool Control OFFLINE”)
luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”, {Message = “Pool Control OFFLINE”, Recipients = “SMTP-Mail”}, vera_alerts_device)

My Variable Container is showing “OFFLINE”, however, the controller is ONLINE.

Any guidance on where to start looking? I’m stuck at this point.

You can delete all the f_LogScene references as that is just a function to log status (or create a function called f_LogScene in your startup Lua and have it log as you wish). Sorry about that.

Ok so I don’t want to hijack this thread. However, I am exploring my options to control my Intellitouch. I have been kicking around getting the Pentair ScreenLogic interface but would really like it to be integrated with my HA in this case I am currently running a Vera3 UI7. I then ran across Autelis which had me just about to pull the trigger on a new HS3PRO system since searching for Intellitouch on this board just left me dazed and confused about my options… that is until I ran across this thread.

Has anyone gotten this working on UI7, is everything controllable just like the mobi, and what does the final interface look like?

rstrouse: I’m running a VeraEdge with UI7 and don’t have the integration working yet, as I’m not really a programmer, but enjoying tinkering with it. Thanks to the mad skills of mda and others, his code has been an excellent starting point. Once I get my code fully functional, I’ll be happy to share. Right now I’ve got the updates from the Autelis populating in the virtual container, but don’t have it working from Vera to the Autelis. However, attached is my Pool view as it stands now.

mda: If I remove the references to f_LogScene as you mentioned, should I also remove the references to: f_SetPoolStatusOnline() throughout the code as well?

If it’s any help I am a programmer but not Lua. Pretty much everything else that may or may not be helpful though from C/C++/C#, assembler, XPath, HTML, css, json, javascript… etc. My OpenWRT skills are pretty weak but I do have some outdated experience with HP-UX. Been doing this a while so I can fiddle and brick a Vera as good as the next guy.

SetPoolStatusOnline() is a function defined in the startup Lua above so it should work. However it is not necessary so you can certainly get rid of calls to it without impacting the core functionality.

The core functionality is 2 parts.

  1. A group of luup.variable_watch functions to act on changes to each variable container variable (to turn on/off your multiswitch buttons etc) as the Autelis send updates to vera.

  2. A group of functions that make http calls to the Autelis to control it when you press a multiswitch button, change a temperature, etc. in Vera.

I also run a scene every 15 min that gets status from the Autelis and updates the variables in vera just to keep everything in sync (in case Autelis fails to update vera on a change for some reason).

I have evolved the code a bit and stopped using a variable container and thermostat devices (to reduce complexity) on my system. I could post my updated code but it might be more confusing at this point?

Thanks for the info mda… I’m operational now thanks to your guidance! Would love to see more on the evolution of your latest code.

I’m a total newbie so please excuse any newbie errors. I’d like to have my indoor swimming pool provide me with pH, chlorine and total chlorine alerts via a smartphone when levels drop out of range. Though we try to check daily, life can get hectic and having a reminder alert would be a good application of smart home technology but when I talked with our pool guy he’d never heard of such a thing. Has anyone done that or is it possible? It looked like some in this thread may have but I wasn’t sure. Thanks in advance!

Do you have Pentair automation such as Intellitouch or Easytouch? When the Pentair pool control plugin is paired with Intellichem it will monitor and alert on all of those values. I believe the thread you are looking for is here.

http://forum.micasaverde.com/index.php/topic,30275.0.html