First scene light door sensor

I’m really beginning with Vera!!!

my goal is to turn on a light when you open the garage door and after 2 minutes the light goes out alone

I have a urn:schemas-upnp-org:device:BinaryLight:1 - device 3 (where a lamp is connected)

I have a 2 door sensors connected with wire to fibaro universal sensor.

(urn:schemas-micasaverde-com:device:MotionSensor:1) device 6 and 7.

this is my scene code

local DS_SID = “urn:schemas-micasaverde-com:device:MotionSensor:1”
local tripped = luup.variable_get(DS_SID, “Tripped”, 6)
if tripped == “1” then
luup.call_action(“urn:schemas-upnp-org:device:BinaryLight:1”, “SetTarget”, {newTargetValue = “1”}, 3)
end

but don’t work

does not turn on the light when I open the door

Thank
;D ;D ;D ;D

where are you running this code?

If you want to trigger an action, you could use a scene. Much easier and you can accomplish that by hitting AUTOMATION tab, then New Scene, etc…

In AUTOMATION → scene → new scene → Luup

lua code placed in the Luup tab will run when at the moment the scene is triggered. are you trying to look at the sensor’s status when the scene is fired and then turn on the light, or are you just trying to turn on a light when the sensor is tripped?

I would like to turn on the light when I go into garage with my car and turn off light after 2 minutes

??? ??? ???

try:

Automation
New Scene
Triggers

Select Add Trigger

Go to your sensor, select “Sensor is Tripped”

Select Devices

On that page, select ON for the light you want to turn on

Select Delays

add a 2 minute delay

On the same device, select OFF

Save the scene press the Red Save Button

You now have a scene which is triggered by the sensor and will turn on the light when the sensor is tripped and turn off the light after two minutes.

Thank Bulldoglowell

Excelent work!!!

;D ;D ;D ;D ;D ;D ;D