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]