Autelis Pool Control and Vera

Has anyone successfully made Autelis Pool Control to work with Vera?

Autelis makes RS-485 to Ethernet adapters for most Jandy/Zodiac and Pentair controllers and has a built web server for over-internet contols.
They added Vera’s Variable Container support recently.

Autelis seems to be much more feature rich solution for supported controllers than Intermatic MultiWave.

There is also discussion on Autelis forum

Please share your Autelis experience.

I am still waiting to receive my autelis with the Vera compatible firmware to test (with a jandy onetouch actually).

Autelis says they are still selling the Jandy interface however nearly everything is out of stock on their website in the pool control section (for months now). This is my plan also to integrate my Jandy RS to the Vera.
Did you get any ideas on the wait time for this product?

Nope, just “we hope to have some available soon”. Sorry.

There appears to be sighs of life on the web page now…

i received my Autelis for Jandy and installed the 1.5.5 autelis firmware for ISY/Vera on it. So far everything seems to be working. The Autelis populates a Variable Container device (details: [url=http://bit.ly/1hN02RX]http://bit.ly/1hN02RX[/url]) as values change on its side and i can control it with http commands from vera scenes eg: <autelis_ip>/set.cgi?name=spa&value=1 to turn on the spa (details: [url=http://bit.ly/GULgh1]http://bit.ly/GULgh1[/url]) .

if anyone who codes professionally has a few free hours to write a plugin (i imagine a Pool device with child devices for pool thermostat, spa thermostat, outdoor temp sensor, and a few switches for various jets, lights, etc - maybe with a way to turn on only those child devices present in the system via check boxes or something) i would be very appreciative and happy to even sponsor some $ to cover the development cost. I believe the autelis team would gladly change their code to update the plugin devices instead of a variable container device.

Thanks!

-mda

Vera is the Programm and Autelis the Device. Am i right?

MDA - have you gotten this setup working yet?

Thanks.

Tom

Yep, it works pretty well. Here is my setup:

  1. a Variable Container device that the autelis can post its updates to (this is the device you set in the Autelis settings, in my case device #169)
  2. a Multiswitch to show and change the status of the pool equipment (device #3 in my system)
  3. a virtual thermostat to control the set point and show temp of the pool
  4. a virtual thermostat to control the set point and show temp of the spa
  5. a virtual temperature device to show the ambient air temp (device file: D_TemperatureSensor1.xml)

Virtual thermostats are from here http://forum.micasaverde.com/index.php/topic,8363.msg53275.html#msg53275

(see attached “Pool devices” screen shot).

The variables in the variable container will be created when the Autelis calls vera to set that variable for the first time, however i run this script (“setup_variables.sh” attached) once from my mac to create all the variables when i setup the device so they are in the correct order (only because it makes them easy to view on the Advanced tab of the variable container device when checking the setup, i do not think the order impacts functionality since the autelis sets the variables by name, in accordance with the order in the Autelis wiki Welcome to autelis.com ). I am no good at shell scripts so this is doubtless the worst shell script you will ever see, sorry, but it works (i suspect this could be re-written by someone smart in about 5 lines :wink: ).

As a reminder, you tell the Autelis where to post its updates by going to “ISY Settings” (they built the Vera compatible firmware on their ISY version and did not change the names) on your Autelis and setting your Vera IP and Variable Container device # (see “Autelis Settings” screen shot attached).

I put the following code into Startup Lua.

The function f_SetPoolStatusOnline updates a variable in the Variable Container with the status of the Autelis and the last time that status was updated. (The value of this function will become clear as you keep reading). The rest of the code updates devices 2-5 above when it detects changes to the Variable Container variables (posted by the Autelis). It also makes http calls to the Autelis whenever one of the devices 2-5 is changed. I am sure this code could be a lot better as i am no expert, but it works ok. It may take 5-15 seconds for a change made to the pool equipment to update the vera device. In my Jandy system, Aux1 is Spa Jets, Aux2 is Spa Lights, Aux3 is Pool Light, Aux4 is Spa Air Blower. If your system is different you will need to adjust the code and the Multiswitch button names accordingly.


-- update status and last update time on variable container for display on HomeWave app and send vera alert if pool status was offline and just changed to online

function f_SetPoolStatusOnline()

-- DEVICES

   local pool_status_device = 169 -- variable container device autelis posts updates to
   local vera_alerts_device = 23 -- to send online alert if previous status was offline

   local PriorOnlineStatus = luup.variable_get("urn:upnp-org:serviceId:VContainer1", "OnlineStatus", pool_status_device)
     if PriorOnlineStatus == "OFFLINE" then
         f_LogScene("Pool Control Online")
         luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = "Pool Control Online", Recipients = "SMTP-Mail"}, vera_alerts_device)
     end
   luup.variable_set("urn:upnp-org:serviceId:VContainer1", "LastPing", os.date('%x %I:%M %p'), pool_status_device)
   luup.variable_set("urn:upnp-org:serviceId:VContainer1", "OnlineStatus", "Online", pool_status_device)
end

-- Autelis Startup Lua

-- DEVICES: update these for your system. ALSO replace the "3" in the multiswitch calls below with your multiswitch device. i am not sure why but i can not get this code to work if i use a variable for the multiswitch device #.

autelis_vc=169 -- pool variable container device id
autelis_pool_tstat=163 -- pool virtual thermostat
autelis_spa_tstat=164 -- spa virtual thermostat
autelis_air_temp=165 -- ambient air temp device
autelis_user="<username>" -- user name for autelis device
autelis_passwd="<password>" -- password for autelis device
autelis_ip="xxx.xxx.xxx.xxx" -- ip address of autelis device

-- update spa temp when pool temp changes and spa is not on and update pool thermo temp
function f_watch_pooltemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature",lul_value_new, autelis_pool_tstat)
  local v_spaOn = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable12", autelis_vc)
     if v_spaOn == "0" then
       luup.variable_set("urn:upnp-org:serviceId:VContainer1", "Variable6",lul_value_new, autelis_vc)
       f_SetPoolStatusOnline()
     end
  end
luup.variable_watch("f_watch_pooltemp","urn:upnp-org:serviceId:VContainer1","Variable4", autelis_vc)

-- update spa temp thermo temp
function f_watch_spatemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature",lul_value_new, autelis_spa_tstat)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spatemp","urn:upnp-org:serviceId:VContainer1","Variable6", autelis_vc)

-- update pool thermo set point
function f_watch_poolsetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.variable_set("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat", "CurrentSetpoint",lul_value_new, autelis_pool_tstat)
end
luup.variable_watch("f_watch_poolsetpoint","urn:upnp-org:serviceId:VContainer1","Variable1", autelis_vc)

-- update spa thermo set point
function f_watch_spasetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.variable_set("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat", "CurrentSetpoint",lul_value_new, autelis_spa_tstat)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spasetpoint","urn:upnp-org:serviceId:VContainer1","Variable3", autelis_vc)

-- update pool pump switch
function f_watch_poolpump(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus1",{newStatus1=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_poolpump","urn:upnp-org:serviceId:VContainer1","Variable10", autelis_vc)

-- update spa pump switch
function f_watch_spapump(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus3",{newStatus3=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spapump","urn:upnp-org:serviceId:VContainer1","Variable12", autelis_vc)

-- update spa jets switch
function f_watch_spajets(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus5",{newStatus5=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spajets","urn:upnp-org:serviceId:VContainer1","Variable19", autelis_vc)

-- update spa blower switch
function f_watch_spablower(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus6",{newStatus6=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spablower","urn:upnp-org:serviceId:VContainer1","Variable22", autelis_vc)

-- update pool light switch
function f_watch_poollight(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus7",{newStatus7=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_poollight","urn:upnp-org:serviceId:VContainer1","Variable21", autelis_vc)

-- update spa light switch
function f_watch_spalight(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus8",{newStatus8=lul_value_new},3)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spalight","urn:upnp-org:serviceId:VContainer1","Variable20", autelis_vc)

-- update pool heat switch
function f_watch_poolheat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
  if (lul_value_new == "1" or lul_value_new == "2") then
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus2",{newStatus2=1},3)
     luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1","SetModeTarget", {NewModeTarget = "HeatOn"}, autelis_pool_tstat)
     luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingState1", "ModeState","Heating", autelis_pool_tstat)
  else
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus2",{newStatus2=0},3)
     luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1","SetModeTarget", {NewModeTarget = "Off"}, autelis_pool_tstat)
     luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingState1", "ModeState","Idle", autelis_pool_tstat)
  end
      f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_poolheat","urn:upnp-org:serviceId:VContainer1","Variable15", autelis_vc)

-- update spa heat switch
function f_watch_spaheat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
  if (lul_value_new == "1" or lul_value_new == "2") then
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus4",{newStatus4=1},3)
     luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1","SetModeTarget", {NewModeTarget = "HeatOn"}, autelis_spa_tstat)
     luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingState1", "ModeState","Heating", autelis_spa_tstat)
  else
     luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus4",{newStatus4=0},3)
     luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1","SetModeTarget", {NewModeTarget = "Off"}, autelis_spa_tstat)
     luup.variable_set("urn:upnp-org:serviceId:HVAC_UserOperatingState1", "ModeState","Idle", autelis_spa_tstat)
  end
      f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_spaheat","urn:upnp-org:serviceId:VContainer1","Variable17", autelis_vc)

-- update pool air temp
function f_watch_poolairtemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature",lul_value_new, autelis_air_temp)
     f_SetPoolStatusOnline()
end
luup.variable_watch("f_watch_poolairtemp","urn:upnp-org:serviceId:VContainer1","Variable5", autelis_vc)

-- set autelis variables based on devices

-- update pool jandy set point
function f_watch_poolthermosetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=poolsp&temp=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch("f_watch_poolthermosetpoint","urn:upnp-org:serviceId:TemperatureSetpoint1_Heat","CurrentSetpoint", autelis_pool_tstat)

-- update spa jandy set point
function f_watch_spathermosetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
     local vURL ="http://"..autelis_ip.."/set.cgi?name=spasp&temp=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch("f_watch_spathermosetpoint","urn:upnp-org:serviceId:TemperatureSetpoint1_Heat","CurrentSetpoint", autelis_spa_tstat)

-- update pool pump
function f_watch_poolpumpSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=pump&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_poolpumpSwitch','urn:dcineco-com:serviceId:MSwitch1','Status1',3)

-- update spa pump
function f_watch_spapumpSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=spa&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_spapumpSwitch','urn:dcineco-com:serviceId:MSwitch1','Status3',3)

-- update spa jets
function f_watch_spajetSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=aux1&value=".. lul_value_new
   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',3)

-- update spa blower
function f_watch_spablowerSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=aux4&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_spablowerSwitch','urn:dcineco-com:serviceId:MSwitch1','Status6',3)

-- update pool light
function f_watch_poollightSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
-- local v_oldvalue = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable21", autelis_vc)
--  if ( lul_value_new ~= v_oldvalue ) then
   local vURL ="http://"..autelis_ip.."/set.cgi?name=aux3&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
--  end
end
luup.variable_watch('f_watch_poollightSwitch','urn:dcineco-com:serviceId:MSwitch1','Status7',3)

-- update spa light
function f_watch_spalightSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=aux2&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_spalightSwitch','urn:dcineco-com:serviceId:MSwitch1','Status8',3)

-- update pool heat from multiswitch
function f_watch_poolheatSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=poolht&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_poolheatSwitch','urn:dcineco-com:serviceId:MSwitch1','Status2',3)

-- update spa heat from multiswitch
function f_watch_spaheatSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   local vURL ="http://"..autelis_ip.."/set.cgi?name=spaht&value=".. lul_value_new
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_spaheatSwitch','urn:dcineco-com:serviceId:MSwitch1','Status4',3)

-- update pool heat from thermostat
function f_watch_poolheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
  if lul_value_new == "Heating" and lul_value_new ~= lul_value_old then
      set_heat = 1
    else -- Idle
      set_heat = 0
  end -- if heating or idle
   local vURL ="http://"..autelis_ip.."/set.cgi?name=poolht&value=".. set_heat
   local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_poolheatStat','urn:upnp-org:serviceId:HVAC_UserOperatingState1','ModeState', autelis_pool_tstat)

-- update spa heat from thermostat
function f_watch_spaheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
  if lul_value_new == "Heating" and lul_value_new ~= lul_value_old then
      set_heat = 1
    else -- Idle
      set_heat = 0
  end -- if heating or idle
      local vURL ="http://"..autelis_ip.."/set.cgi?name=spaht&value=".. set_heat
      local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch('f_watch_spaheatStat','urn:upnp-org:serviceId:HVAC_UserOperatingState1','ModeState', autelis_spa_tstat)

This is the luup code i put in a scene i call “Ping Pool Control” with a schedule to run every 15 minutes. It checks to make sure the Autelis is online and uses vera alerts to send an alert if it is online:


-- Ping Pool Control scene luup

-- DEVICES
local vURL ="http://<xxx.xxx.xxx.xxx>/status.xml" -- xxx.xxx.xxx.xxx to your Autelis IP address
local vCode, vData = luup.inet.wget(vURL,5,"<autelis user name>","<autelis password")
local pool_status_device = 169 -- the variable container device # that Autelis posts updates to
local vera_alerts_device = 23 -- to send online alert if previous status was offline


if vCode == 0 then
   f_SetPoolStatusOnline()
 else
   luup.variable_set("urn:upnp-org:serviceId:VContainer1", "LastPing", os.date('%x %I:%M %p'), pool_status_device)
   luup.variable_set("urn:upnp-org:serviceId:VContainer1", "OnlineStatus", "OFFLINE", pool_status_device)
   f_LogScene("Pool Control OFFLINE")
   luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message = "Pool Control OFFLINE", Recipients = "SMTP-Mail"}, vera_alerts_device)
end

I hope this helps. It would probably be better implemented in PLEG but I have not made the move to PLEG yet; if anyone else would like to do the PLEG implementation I would be happy to walk through the business logic in the startup Lua of course.

-mda

@MDA, awesome work.

I think I am missing something. I am trying to follow your setup, but there’s a couple things I do not understand.

My VC is getting updated by the Autelis successfully. What causes the functions in startup to be evaluated? I see that f_SetPoolStatusOnline is called by the scene, but what about the other functions, such as f_watch_pooltemp, f_watch_spatemp, etc?

Thanks! … just a lot of messy trial and error and still not 100% reliable, but i keep chipping away at it :slight_smile:

In the startup Lua it tells vera to watch the variables in the variable container with a luup.variable_watch for each variable in the variable container (http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_watch). When those variables change Vera calls the appropriate function for that changed variable.

For example, this bit of code in the startup Lua tells Vera to watch the variable “Variable10” in the “autelis_vc” variable container device. Any time Variable10 is updated (by the Autelis’ http calls to vera), the function “f_watch_poolpump” gets called.

luup.variable_watch("f_watch_poolpump","urn:upnp-org:serviceId:VContainer1","Variable10", autelis_vc)

The f_watch_poolpump function gets the new value of Variable10 passed to it by Vera in the lul_value_new variable and in this case it sets the first button of the Multiswitch device (device #3 in my case) to lul_value_new (which will be 1 if the pool pump is on or 0 if the pool pump is off). There are some cases (heat for example) where Autelis might send 0, 1, or 2 as the value and the functions for those variables convert those to 0 or 1 appropriately.

-- update pool pump switch function f_watch_poolpump(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new) luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus1",{newStatus1=lul_value_new},3) f_SetPoolStatusOnline() end

Nice! Thank you for the explanation. I have not really played with the startup lua until now. At this point, I just need to customize it to my system. If you make any further improvements, please post them! Thank you again.

@PJJP

I think there is a bug in my code that is turning the pool heater off if heat is set to enabled (pump is off and heat is set to on). I will let you know as soon as i sort it out. (might have something to do with me messing something up during my recent move to multiswitch, not sure).

@PJJP

I found the bug… it is in the last 2 sections “update pool heat from thermostat” and “update spa heat from thermostat”. They should be as follows (i will also update the post above). Sorry about that.

[code]-- update pool heat from thermostat
function f_watch_poolheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if lul_value_new == “Heating” and lul_value_new ~= lul_value_old then
set_heat = 1
else – Idle
set_heat = 0
end – if heating or idle
local vURL =“http://”…autelis_ip…“/set.cgi?name=poolht&value=”… set_heat
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_poolheatStat’,‘urn:upnp-org:serviceId:HVAC_UserOperatingState1’,‘ModeState’, autelis_pool_tstat)

– update spa heat from thermostat
function f_watch_spaheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if lul_value_new == “Heating” and lul_value_new ~= lul_value_old then
set_heat = 1
else – Idle
set_heat = 0
end – if heating or idle
local vURL =“http://”…autelis_ip…“/set.cgi?name=spaht&value=”… set_heat
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spaheatStat’,‘urn:upnp-org:serviceId:HVAC_UserOperatingState1’,‘ModeState’, autelis_spa_tstat)[/code]

thanks to the XML tip from @akbooer i was able to update the “ping pool control device” scene luup to also refresh vera’s variable container device with Autelis variables every few minutes – just to make sure it stays in sync. (notice the logic here around setting the Spa Temperature is the same as in the startup lua; since my Jandy system reports a temp of zero if the spa is turned off, i use the pool temp in that case since in my setup the spa will be the same temp as the pool until the spa is on and might be heated.)

[code]-- Ping Pool Control scene luup

– DEVICES
local vera_alerts_device = 23 – to send online alert if previous status was offline
– END DEVICES

local vURL = autelis_ip…“/status.xml”
local vCode, vData = luup.inet.wget(vURL,5, autelis_user, autelis_passwd)

if vCode == 0 then
f_SetPoolStatusOnline()

local v_runstate = vData: match “([^<])"
local v_pump = vData: match "([^<]
)”
local v_spapump = vData: match “([^<])"
local v_poolht = vData: match "([^<]
)”
local v_spaht = vData: match “([^<])"
local v_spajets = vData: match "([^<]
)”
local v_spalight = vData: match “([^<])"
local v_poollight = vData: match "([^<]
)”
local v_spablower = vData: match “([^<])"
local v_poolsp = vData: match "([^<]
)”
local v_spasp = vData: match “([^<])"
local v_pooltemp = vData: match "([^<]
)”
local v_spatemp = vData: match “([^<])"
local v_airtemp = vData: match "([^<]
)”

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable10”, v_pump, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable12”, v_spapump, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable15”, v_poolht, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable17”, v_spaht, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable19”, v_spajets, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable20”, v_spalight, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable21”, v_poollight, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable22”, v_spablower, autelis_vc)

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”, v_poolsp, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable3”, v_spasp, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable4”, v_pooltemp, autelis_vc)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable5”, v_airtemp, autelis_vc)

if v_spapump == “1” then – spa pump is on so use spa temp
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable6”, v_spatemp, autelis_vc)
else – use pool temp
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable6”, v_pooltemp, autelis_vc)
end

else
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)
end[/code]

This is awesome @mda. I am going try your code tomorrow…

@MDA - Thanks for this!

I modified the code and have the thermostats and outside temp device correctly reporting the data from the variable container, but for some reason I can’t seem to get the MSwitch to work.

I updated your device number 3 to mine (218). When that didn’t work, I noticed that your code referenced “com:device:MSwitch1” and my device showed “com:device:MSwitch218”, so I tried changing the LUP code to that. Still not functional.

Any idea of what I may have messed up?

Thanks!

Tom

I, at least for now, used MDA’s code, but went with a more simplistic approach, bypassing the thermostats. I decided that I didn’t need to duplicate the functionality of the existing Auqualink iphone app, so I just implemented the following via scenes:

  • LED lights on at sunset, off at 11pm
  • Turn off / on Slide/waterfall/dibing board waterfall.
    -If night, also turn on/off diving board internal waterfall lights
  • Turn Spa heater on, then send prowl msg confirmation plus estimated heating time in minutes.
  • When spa heat reaches 99?, turn on blower and additional jets, then send prowl msg that spa is ready.
    -Spa off, plus prowl msg confirming it’s off
    -All Off

It’s not as robust as MDA’s full implementation, but it’s really all I need to get the automation I want.

[quote=“tdinardo, post:17, topic:175685”]@MDA - Thanks for this!

I modified the code and have the thermostats and outside temp device correctly reporting the data from the variable container, but for some reason I can’t seem to get the MSwitch to work.

I updated your device number 3 to mine (218). When that didn’t work, I noticed that your code referenced “com:device:MSwitch1” and my device showed “com:device:MSwitch218”, so I tried changing the LUP code to that. Still not functional.

Any idea of what I may have messed up?

Thanks!

Tom[/quote]

hmm… when you say your device showed “com:device:MSwitch218” where did it show that?

I don’t think i have “com:device:MSwitch1” in my code anywhere. The closest thing i have is a service id “urn:dcineco-com:serviceId:MSwitch1” and that does not change based on the device id, it is always “urn:dcineco-com:serviceId:MSwitch1”. for example to turn button 5 in multswitch device ID #3 on or off, my code uses this line:

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

where “urn:dcineco-com:serviceId:MSwitch1” is the service Id for turning a multiswitch button on/off, “SetStatus5” and “newStatus5” reference button 3 and “,3” references device #3

does that help at all?

OK. Disregard my “device showed” comment. I get what I did wrong there (being a bonehead working on this too late…).

I backed out what I did related to that and everything is using the MSwitch1 code as you had it pointing to my MSwitch which is device #218.

That being said, things still aren’t working. Basically all the controls populate with data from Autelis, but any attempt to control the equipment from Vera does not work. The MSwitch does not register the status of the equipment if changed from one of the pool controls and does not activate/deactivate the equipment if I attempt to control it through Vera. The thermostats in Vera do not adjust the setpoint on the Jandy side.

Can you take a peek at my code and let me know if you see anything glaringly incorrect?

[code]-- update status and last update time on variable container for display on HomeWave app and send vera alert if pool status was offline and just changed to online

function f_SetPoolStatusOnline()

– DEVICES

local pool_status_device = 222 – variable container device autelis posts updates to
local vera_alerts_device = 225 – to send online alert if previous status was offline

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

– Autelis Startup Lua

– DEVICES: update these for your system. ALSO replace the “3” in the multiswitch calls below with your multiswitch device. i am not sure why but i can not get this code to work if i use a variable for the multiswitch device #.

autelis_vc=222 – pool variable container device id
autelis_pool_tstat=219 – pool virtual thermostat
autelis_spa_tstat=220 – spa virtual thermostat
autelis_air_temp=221 – ambient air temp device
autelis_user=“USERNAME” – user name for autelis device
autelis_passwd=“PASSWORD” – password for autelis device
autelis_ip=“x.x.x.x” – ip address of autelis device

– update spa temp when pool temp changes and spa is not on and update pool thermo temp
function f_watch_pooltemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”,lul_value_new, autelis_pool_tstat)
local v_spaOn = luup.variable_get(“urn:upnp-org:serviceId:VContainer1”,“Variable12”, autelis_vc)
if v_spaOn == “0” then
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable6”,lul_value_new, autelis_vc)
f_SetPoolStatusOnline()
end
end
luup.variable_watch(“f_watch_pooltemp”,“urn:upnp-org:serviceId:VContainer1”,“Variable4”, autelis_vc)

– update spa temp thermo temp
function f_watch_spatemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”,lul_value_new, autelis_spa_tstat)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spatemp”,“urn:upnp-org:serviceId:VContainer1”,“Variable6”, autelis_vc)

– update pool thermo set point
function f_watch_poolsetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”, “CurrentSetpoint”,lul_value_new, autelis_pool_tstat)
end
luup.variable_watch(“f_watch_poolsetpoint”,“urn:upnp-org:serviceId:VContainer1”,“Variable1”, autelis_vc)

– update spa thermo set point
function f_watch_spasetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”, “CurrentSetpoint”,lul_value_new, autelis_spa_tstat)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spasetpoint”,“urn:upnp-org:serviceId:VContainer1”,“Variable3”, autelis_vc)

– update pool pump switch
function f_watch_poolpump(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus1”,{newStatus1=lul_value_new},218)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_poolpump”,“urn:upnp-org:serviceId:VContainer1”,“Variable10”, autelis_vc)

– update spa pump switch
function f_watch_spapump(lul_device, lul_service, lul_variable, lul_value_old, 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)

– update spa jets switch
function f_watch_spajets(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus5”,{newStatus5=lul_value_new},218)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spajets”,“urn:upnp-org:serviceId:VContainer1”,“Variable19”, autelis_vc)

– update spa blower switch
function f_watch_spablower(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus6”,{newStatus6=lul_value_new},218)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spablower”,“urn:upnp-org:serviceId:VContainer1”,“Variable22”, autelis_vc)

– update pool light switch
function f_watch_poollight(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus7”,{newStatus7=lul_value_new},218)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_poollight”,“urn:upnp-org:serviceId:VContainer1”,“Variable21”, autelis_vc)

– update spa light switch
function f_watch_spalight(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus8”,{newStatus8=lul_value_new},218)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spalight”,“urn:upnp-org:serviceId:VContainer1”,“Variable20”, autelis_vc)

– update pool heat switch
function f_watch_poolheat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if (lul_value_new == “1” or lul_value_new == “2”) then
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus2”,{newStatus2=1},218)
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”, {NewModeTarget = “HeatOn”}, autelis_pool_tstat)
luup.variable_set(“urn:upnp-org:serviceId:HVAC_UserOperatingState1”, “ModeState”,“Heating”, autelis_pool_tstat)
else
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus2”,{newStatus2=0},218)
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”, {NewModeTarget = “Off”}, autelis_pool_tstat)
luup.variable_set(“urn:upnp-org:serviceId:HVAC_UserOperatingState1”, “ModeState”,“Idle”, autelis_pool_tstat)
end
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_poolheat”,“urn:upnp-org:serviceId:VContainer1”,“Variable15”, autelis_vc)

– update spa heat switch
function f_watch_spaheat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if (lul_value_new == “1” or lul_value_new == “2”) then
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus4”,{newStatus4=1},218)
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”, {NewModeTarget = “HeatOn”}, autelis_spa_tstat)
luup.variable_set(“urn:upnp-org:serviceId:HVAC_UserOperatingState1”, “ModeState”,“Heating”, autelis_spa_tstat)
else
luup.call_action(“urn:dcineco-com:serviceId:MSwitch1”,“SetStatus4”,{newStatus4=0},218)
luup.call_action(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“SetModeTarget”, {NewModeTarget = “Off”}, autelis_spa_tstat)
luup.variable_set(“urn:upnp-org:serviceId:HVAC_UserOperatingState1”, “ModeState”,“Idle”, autelis_spa_tstat)
end
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_spaheat”,“urn:upnp-org:serviceId:VContainer1”,“Variable17”, autelis_vc)

– update pool air temp
function f_watch_poolairtemp(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”,lul_value_new, autelis_air_temp)
f_SetPoolStatusOnline()
end
luup.variable_watch(“f_watch_poolairtemp”,“urn:upnp-org:serviceId:VContainer1”,“Variable5”, autelis_vc)

– set autelis variables based on devices

– update pool jandy set point
function f_watch_poolthermosetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=poolsp&temp=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(“f_watch_poolthermosetpoint”,“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”,“CurrentSetpoint”, autelis_pool_tstat)

– update spa jandy set point
function f_watch_spathermosetpoint(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=spasp&temp=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(“f_watch_spathermosetpoint”,“urn:upnp-org:serviceId:TemperatureSetpoint1_Heat”,“CurrentSetpoint”, autelis_spa_tstat)

– update pool pump
function f_watch_poolpumpSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=pump&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_poolpumpSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status1’,218)

– update spa pump
function f_watch_spapumpSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=spa&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spapumpSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status3’,218)

– update spa jets
function f_watch_spajetSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=aux1&value=”… lul_value_new
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)

– update spa blower
function f_watch_spablowerSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=aux4&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spablowerSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status6’,218)

– update pool light
function f_watch_poollightSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
– local v_oldvalue = luup.variable_get(“urn:upnp-org:serviceId:VContainer1”,“Variable21”, autelis_vc)
– if ( lul_value_new ~= v_oldvalue ) then
local vURL =“http://”…autelis_ip…“/set.cgi?name=aux3&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
– end
end
luup.variable_watch(‘f_watch_poollightSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status7’,218)

– update spa light
function f_watch_spalightSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=aux2&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spalightSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status8’,218)

– update pool heat from multiswitch
function f_watch_poolheatSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=poolht&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_poolheatSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status2’,218)

– update spa heat from multiswitch
function f_watch_spaheatSwitch(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local vURL =“http://”…autelis_ip…“/set.cgi?name=spaht&value=”… lul_value_new
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spaheatSwitch’,‘urn:dcineco-com:serviceId:MSwitch1’,‘Status4’,218)

– update pool heat from thermostat
function f_watch_poolheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if lul_value_new == “Heating” and lul_value_new ~= lul_value_old then
set_heat = 1
else – Idle
set_heat = 0
end – if heating or idle
local vURL =“http://”…autelis_ip…“/set.cgi?name=poolht&value=”… set_heat
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_poolheatStat’,‘urn:upnp-org:serviceId:HVAC_UserOperatingState1’,‘ModeState’, autelis_pool_tstat)

– update spa heat from thermostat
function f_watch_spaheatStat(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if lul_value_new == “Heating” and lul_value_new ~= lul_value_old then
set_heat = 1
else – Idle
set_heat = 0
end – if heating or idle
local vURL =“http://”…autelis_ip…“/set.cgi?name=spaht&value=”… set_heat
local vCode, vData = luup.inet.wget(vURL,5,autelis_user,autelis_passwd)
end
luup.variable_watch(‘f_watch_spaheatStat’,‘urn:upnp-org:serviceId:HVAC_UserOperatingState1’,‘ModeState’, autelis_spa_tstat)[/code]