Need help in debuging a scene

Hello all

I am trying to write a Luup which does the followings:
-waiting 30 seconds after the scene is RUN
-check if the DOOR sensor is Armed then turn on device number 12
-if not then turn on device number 6

here is what i did:

function tuning()
local doorstatus = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “status”, 6)

if (doorstatus = “armed”) then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 12)
else
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 14)
end

luup.call_timer(“tuning”,1,30,“”,“”)

but it has an error
help will be appreciated

Hello,

I made some changes to your code.

[ol][li]The state variable for the armed status is Armed.[/li]
[li]Armed is of type boolean, so the values it can take are “0” and “1”.[/li]
[li]For small time delays luup.call_delay should be used instead of luup.call_timer.[/li][/ol]

To see the state variables and actions defined for a service, you should check the service description file (S_…xml). In this case it’s S_SecuritySensor1.xml.

function tuning()
    local doorstatus =  luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Armed", 6)
    if (doorstatus == "1") then
        luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 12)
    else
        luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 14)
    end
end

luup.call_delay("tuning", 30)

thank you mcvflorin
it worked exactly as i wanted

regards

one question, how can i make this device#12 on for 30 seconds only inside the if?

try to move forward on my problem

I get good value for my condition relayboard in your virtual container with this (I will fetch the values ​​are up and dn)

local PortailDelph = extractElement("btn2", rss, "N/A")
luup.variable_set("urn:upnp-org:serviceId:VContainer1","VariableName1","Portail Del",54)
luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable1", PortailDelph, 54)

by cons I can not seem to update the state of the virtual switch as it wants of 0 and 1 for its status

if PortailDelph == dn then
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 1, 44)
else
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 0, 44)
end

Do you have an idea to be able to update the status of the virtual switch?

i have try this but no result for my matter

if (PortailDelph == "dn") then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 44) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 44) end

but no result
help me please
my post [url=http://forum.micasaverde.com/index.php/topic,7809.msg66030.html#msg66030]http://forum.micasaverde.com/index.php/topic,7809.msg66030.html#msg66030[/url]
thanks
DAvid