Noob here, please check my script :)

So here is what I am trying to achieve…

I have door sensor on the door leading from the garage to the interior of the house.
If it’s night and no one is home, turn the kitchen, front entrance and hallway lights on.

For the presence checking I’m going to turn a virtual switch on if any of my other interior lights are on. And I’ve setup an “all off, leaving home” switch in my garage which will turn off all the switches as well as the virtual switch.

Here is the code I came up with:

[code]
local DS_SID = “urn:schemas-micasaverde-com:device:MotionSensor:1”
local VS_SID = “urn:schemas-upnp-org:device:VSwitch:1”

local tripped = luup.variable_get(DS_SID, “Tripped”, 9)
local swon = luupvaribale_get(VS_SID, “Status”, 14)
if tripped == “1” then
if (luup.is_night()) then
if swon == “1” then
luup.call_action(“urn:schemas-upnp-org:device:BinaryLight:1”, “SetTarget”, (newTargetValue = “1”), 4)
luup.call_action(“urn:schemas-upnp-org:device:BinaryLight:1”, “SetTarget”, (newTargetValue = “1”), 13)
luup.call_action(“urn:schemas-upnp-org:device:DimmableLight:1”, “SetTarget”, (newTargetValue = “1”), 6)
else
return false
else
return false
else
return false

	end
end

end[/code]

Thanks,
Akash

Akash,

If you are on UI5, dump the Luup and use this: http://forum.micasaverde.com/index.php/topic,10995.0.html