EZMotion sensor scripting help

Hi Everyone,

I am a relative beginner to Lua scripting for Vera2 devices and would appreciate any advice you have for me. So I have an EZMotion 3-in-1 sensor set to “Always On” mode, so there is no time out and it trips as fast as possible. (I am connecting it to an adapter so it doesnt have to use battery power).

From there, I want to send data to Cosm every time it detects motion. The problem is that the device never “Un-trips” since it is on the always on mode. What I want to do is code in a function that periodically checks if there has been motion detected in a previously set time span. (For example, if there was motion detected in the last 5 seconds then send a “1”, if there was no motion detected then send a “0”) And it would continue to send "0"s every 5 seconds if no motion has been detected. However if someone were to wave their hand in front of the sensor, it would send "1"s every 5 seconds.

To implement something like that, could I do it with Scenes/Triggers? It would seem like the answer would be no because every time the “armed sensor was tripped” It would rerun the Luup code (which would contain an infinite loop/timer pretty much). So would a plugin be the only option? I would prefer to use Scenes/Triggers if there was a way.

Please let me know!!! Thanks!!

Hi Stellarbruin14

Forgive me if I am telling you what you already know.

The EZmotion should be seen more as an occupancy sensor, rather than a motion sensor so when it sees motion it will stay tripped for the period of time you have set in the Always on device control.

So if you were to set Always On to 5 minutes, once it detects motion (based on the sensitivity setting) and trips “1” it will start off an internal counter within the EZmotion to make it wait 5 mins before it will send vera the un trip “0” command.

It’s probably best to get the sensor working how you want as is before you start altering Vera’s opinion of what the actual sensors status is. (If you know what I mean)

If you know what you want, then to help you there is always the 'Last Tripped ’ variable that is captured on the sensor so you can always look to that and do a check up when it was last tripped. However if it is tripping every time - then I’m not sure what value that brings.

Again, I may have miss understood your target here, so happy to help out more if I can…

Better late than never - check http://wiki.micasaverde.com/index.php/ExpressControls3in1 for more details on programming EZMotion.

5 seconds is really fast to detect motion vs no-motion!
EZMotion even when OnTime=0 will only send a Motion event once per minute.