Over ride motion sensor when remote or phone has turn off light

I have a scene to turn on light when motion is detected. It turns light off after certain amount of time when no motion is detected.

How can I disable the motion sensor from turning on the lights when a user manually turns light off by switch, remote, web interface, or by phone.

I would like to over ride the sensor for 30 min if one of the above actions happen.

I am ui7.

One approach is to use Lua code in your scene to prevent it running if the light was turned off within the last 30 minutes. This cannot distinguish how the light was turned off - only that it happened. The principle is to use the timestamp of when the light status last changed to off. If we compare that to the current time, we can allow or block the scene.

The following code, if added to a scene’s Lua tab, will prevent the actions from running if the light was turned off within the last thirty minutes:

local dID = 123 -- Device ID of light switch local status, time = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",dID) local tnow = os.time() if status == "0" then return (tnow > ((time or 0) + 1800)) else return false end

Replace 123 with the device number of your light switch.

Thank you. I will try it

One work around I have done is I have set lights to work on motion when the sensors are armed. When they are disarmed the lights to do not turn on…Then I have the sensors arm themselves every 30 min

I got around this with PLEG and a bunch of scenes. First, my PLEG device returns True if it is night out (these are outdoor lights) and either of my motion sensors is triggered (don’t get me going about false positives). I also have the opposite condition for when motion detection stops.

Then there are 4 scenes, two control the auto on / off functionality based on the two PLEG conditions and whether or not the device is armed (the key here)

Now, for the “Manual Override” scenes, it helps that I’m controlling an AEON Labs Powerstrip, so I have to use a virtual switch anyways, but if you were controlling actual switches you’d likely have to rewire those lights to use an inline module and replace the wall switch with a remote trigger. Whenever I trigger the manual override scene to turn on the lights, it disarms the PLEG device, hence stopping the auto on / off scene from executing. There’s another manual override that turns them off and arms the device to put it back into auto mode.