Okay, so I had a small luup script to “arm” my Vera into away mode. I then recently added a conditional so the system will not arm if a door or windows is open, and flash the portch light 3 times. I’m now getting weird behavior, and I figure theres something wrong with the code causing the weird behavior in my other LUUP codes. FYI Node 4 is a speaker that makes beeping sounds, and device 27 is the porch light. The code seems to work, other than the weirdness with other scenes after implementing. Any help is appreciated much!! Here is the code I put together:
Device = "urn:micasaverde-com:serviceId:SecuritySensor1"
KidsSlider = luup.variable_get(Device,"Tripped",16)
LoungeSlider = luup.variable_get(Device,"Tripped",12)
MasterSlider = luup.variable_get(Device,"Tripped",14)
FrontDoor = luup.variable_get(Device,"Tripped",10)
function arm (empty)
luup.call_action('urn:micasaverde-com:serviceId:HomeAutomationGateway1', 'SetHouseMode', { Mode=2 }, 0)
end
if (KidsSlider == "0") and (LoungeSlider == "0") and (MasterSlider == "0") and (FrontDoor == "0") then
luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='4',Data='112 4 6 1 5'},1)
luup.sleep(9000)
luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='4',Data='112 4 6 1 6'},1)
luup.call_delay("arm", 20, "")
else
luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='4',Data='112 4 6 1 4'},1)
counter = 3
original_status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","status",27)
while counter > 0 do
counter = counter-1
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },27)
luup.sleep(1000)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },27)
luup.sleep(1000)
end
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue=original_status },27)
end