Code help needed

How would the below code get converted to monitor the arm/bypass state of 2 Ping Sensors?

[code]local Switch1 = 147
local Switch2 = 157

local Light1State= luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”, Switch1)

local Light2State= luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”, Switch2)

if (Light1State == “1”) or (Light2State == “1”)
then
return false
else[/code]

JOD.

Have you played with the following, taken from the wiki?

...
local SS_SID = "urn:micasaverde-com:serviceId:SecuritySensor1" -- Security Sensor Service ID
local armed = luup.variable_get (SS_SID, "Armed", deviceNo)
if (armed == "1") then
...

I’ve tried so many combinations I’m more confused now than when I started.

I need: When two sensors are in bypass, don’t run the scene.

JOD.

:slight_smile: Have you attempted something along the following untested lines?

local SS_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
local armedState1 = luup.variable_get (SS_SID, "Armed", <dev1>)
local armedState2 = luup.variable_get (SS_SID, "Armed", <dev2>)
if (armedState1 == "0") and (armedState2 == "0") then
  return false
else
  return true
end

That worked.

Thanks oTi@

JOD.