Futzle,
No problem. Sorry I wasnât clear in the first go around. Letâs see if I can do better. 
So to keep this simple letâs just focus on when my alarm panel disarms.
Currently when the alarm is disarmed a scene called SystemDisarm is triggered and does the following:
Step1: Under Devices Lights it turns on interior lights
Step2: It runs LUUP code (below) which flashes my porch light a few times.
[code]local array_lights = {19}
local original_status={}
local counter = 3
local delay = 2
function set_switch(device,value)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,{ newTargetValue=value },device)
end
function tree_on()
for i, device in ipairs(array_lights) do
set_switch(device,â1â)
end
luup.call_delay( âtree_offâ, delay )
end
function tree_off()
counter = counter-1
if counter > 0 then
for i, device in ipairs(array_lights) do
set_switch(device,"0")
end
luup.call_delay( 'tree_on', delay )
else
âSet to original status
for i, device in ipairs(array_lights) do
set_switch(device,original_status[i])
end
end
end
âSave Original status
for i, device in ipairs(array_lights) do
original_status[i] = luup.variable_get(âurn:upnp-org:serviceId:SwitchPower1â,âStatusâ, device)
end
tree_off()
end[/code]
This works great but it turns my interior lights on during the day and night, which isnât very convenient.
So what Iâm wanting to do is disable the lights in the devices tab from turning on. Rebuild my LUUP code to not only flash the porch light like above but then check my CombinationSwitch (which tracks Heliotrope app) and only if itâs night time turn on the interior lights.
What I was doing was just appending my new code to the bottom of the existing code like:
[code]ocal array_lights = {19}
local original_status={}
local counter = 3
local delay = 2
function set_switch(device,value)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,{ newTargetValue=value },device)
end
function tree_on()
for i, device in ipairs(array_lights) do
set_switch(device,â1â)
end
luup.call_delay( âtree_offâ, delay )
end
function tree_off()
counter = counter-1
if counter > 0 then
for i, device in ipairs(array_lights) do
set_switch(device,"0")
end
luup.call_delay( 'tree_on', delay )
else
âSet to original status
for i, device in ipairs(array_lights) do
set_switch(device,original_status[i])
end
end
end
âSave Original status
for i, device in ipairs(array_lights) do
original_status[i] = luup.variable_get(âurn:upnp-org:serviceId:SwitchPower1â,âStatusâ, device)
end
tree_off()
â Find Status of HelioTrope Combination Switch
local device = 38
local status = luup.variable_get(âurn:futzle-com:serviceId:CombinationSwitch1â, âStatusâ, device)
local FrontRoom = 20
local kidroom1 = 29
local kidroom2 = 28
function Lights_On()
if (status == â1â) then
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,FrontRoom)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,kidroom1)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,kidroom2)
end
end[/code]
Now what Iâm thinking is that it would be more like:
[code]local combo_switch = {38}
ocal status = luup.variable_get(âurn:futzle-com:serviceId:CombinationSwitch1â, âStatusâ, combo_switch)
local front_room = {20}
local kid_room1 = {29}
local kid_room2 = {28}
local array_lights = {19}
local original_status={}
local counter = 3
local delay = 2
function lights_on()
if (status ==â1â) then
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,front_room)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,kid_room1)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,ânewTargetValue=1â,kid_room2)
function set_switch(device,value)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue=value },device)
end
function tree_on()
for i, device in ipairs(array_lights) do
set_switch(device,"1")
end
luup.call_delay( 'tree_off', delay )
end
function tree_off()
counter = counter-1
if counter > 0 then
for i, device in ipairs(array_lights) do
set_switch(device,"0")
end
luup.call_delay( 'tree_on', delay )
else
--Set to original status
for i, device in ipairs(array_lights) do
set_switch(device,original_status[i])
end
end
else
function set_switch(device,value)
luup.call_action(âurn:upnp-org:serviceId:SwitchPower1â,âSetTargetâ,{ newTargetValue=value },device)
end
function tree_on()
for i, device in ipairs(array_lights) do
set_switch(device,"1")
end
luup.call_delay( 'tree_off', delay )
end
function tree_off()
counter = counter-1
if counter > 0 then
for i, device in ipairs(array_lights) do
set_switch(device,"0")
end
luup.call_delay( 'tree_on', delay )
else
--Set to original status
for i, device in ipairs(array_lights) do
set_switch(device,original_status[i])
end
end
end
[/code]
Sorry if this makes it worse. But thanks for being patient.