I’ve been thinking through the logic, and I think I may know how to prevent false positives from triggering the motion sensor. I came up with the idea after reading the section of the Luup wiki that talks about the “Thermostat conditioned by door/window”.
http://wiki.micasaverde.com/index.php/Luup_Scenes_Events#Thermostat_conditioned_by_door.2Fwindow
The problem is I have never coded at all for MIOS and have no clue how to do Luup code.
But here goes the idea:
- Set motion sensor timeout to a much faster setting than usual (i.e. 1 second if you really want to eat the batteries lol).
- Have the luup code run and only trigger for an armed sensor that detects two trips in a row within a certain time frame (if the motion time out is X seconds, allow the two trips to be seen within Y seconds, to give it time to trip again in case whoever is tripping the device stopped moving for a little while).
- False triggers should be taken care of, since from what I have seen are pretty random and are never that close together (I am running my motion time out at 1 second).
So if you set X to 1 second and Y to 10 seconds the code should cause this to occur: False trigger occurs with an armed sensor. A timer counts down from 10 seconds and waits to see if there is a second trigger, assuming the second trigger would be a real motion and not a false trigger. If it is a false trigger, the timer gets to 0 without detecting another motion trigger and nothing is sent to run the scene. If it is a real motion trigger, then the persons presence will trigger it again after 1 second and the timer hasn’t reached 0 yet, so the scene will run.
I think this is how you would go about doing it, but for some reason all I get is “ERROR : Error in lua for scenes and events”
[code]local SENSOR = 51 – The multisensor motion detector device number
local DELAY = 6 – Seconds to wait to check for a second trip
local SES_SID = “urn:micasaverde-com:serviceId:SecuritySensor1” – Not sure what to put here…
luup.call_delay( “falseTrigger”, DELAY)
– Skip running this scene if the last trip was more than DELAY seconds ago (a false trigger).
– Somehow this needs to only apply to when the 4 in 1 multi sensor is tripped, and not anything
– else that may start the scene. Otherwise, if something else triggers the scene and the
– multisensor hasn’t gone off in the last DELAY seconds, then it will think its a false trigger
– and exit out of the scene. If this isn’t possible, then there will always need to be a separate scene for the
– multisensors to activate, even if the scene is generally activated by other things as well.
function falseTrigger()
local lastTrip = luup.variable_get( SES_SID, “LastTrip”, SENSOR) or os.time()
– if statement also needs to include a check to see if the thing that is triggering the scene
– is a multisensor.
if (os.time() - lastTrip >= DELAY) then
return false
Else
return true
– Else statement will allow the scene to run if it is likely a real trigger
end
end[/code]