Rules, variables, and timestamps?

miamicanes

Active Member
Do M1G rules have access to variables, and are timestamps something that can be stored as a variable & queried by a later rule as "number of (milli-)seconds between ${timestamp-in-variable} and ${now}"?

Can I set "timer events" to fire in the future? For example, 500ms from now, 1 second from now, 1 minute from now, 30 minutes from now, etc?

Here's the problem I'm trying to solve. In my living room, I have two ShockTec sensors (one attached to the front door, one attached to the sliding glass door a few feet away), a glassbreak sensor, and a motion detector. I don't trust any of them individually to NOT false-alarm, so I want to evaluate them in the context of other sensors in the room.

For example, I have a MAJOR problem with vibrations from cars, motorcycles, and 18" subwoofers on the road about 100 feet from the doors, as well as thunder. However, I came up with a nifty way to tell the difference between breaking glass and general noise... all things otherwise being equal, an impact that smashes a pane on the sliding glass door is going to trigger the sensor mounted to the sliding glass door frame, but NOT the sensor mounted to the front door. On the other hand, road noise and thunder will trigger BOTH sensors, or only the one on the front door.

Similarly, I don't want the motion detector or glassbreak sensor to unilaterally trigger a general alarm... at least, not until I've had the glassbreak sensor monitored and logged for a few months and I feel confident that thunder and road noise won't trigger it. So, I want to trigger the alarm if two out of three sensors trigger (treating the ShockTec pair as a single sensor, ignoring it entirely when the front-door sensor registers a shock within 500ms of the glass door). I've sort of come up with a way to do this using an Atmel microcontroller, some MOSFETs, and a relay to sit as a buffer between the ShockTec sensors and M1G... but I'd rather do the whole thing in software on the M1G if I can. Better yet, I'd like to ignore events from the motion sensor unless a glassbreak or single-door shock is seen FIRST, within the previous 15 seconds, but ignoring motion events during the first 2 or 3 seconds after a glassbreak/shock event. Rationale: a loud noise will scare my cats if they're in the room, causing an instant motion detection followed by no motion detection for at least a minute or two (while they hide). A real burglar will still be moving around the room 3-5 seconds later.

On a related note, is there any way for me to connect all the sensors to the M1G and (for now) have it ignore the new sensors for alarm-triggering purposes, but log each time they fire so I can periodically connect to the M1G using my computer and get a feel for their real-world false alarm potential? This is the perfect time to do it, because we've been having major afternoon thunderstorms on a regular basis.
 
Future events are usually "scheduled" using "Outputs", i.e.,

Code:
WHENEVER <condition>
	THEN TURN OUTPUT 40 ON FOR 90 SECONDS

WHENEVER OUTPUT 40 TURNS OFF
	THEN <perform your functions>

You can count events easily and pull the values in various ways. But without an external system of some sort to talk to your ELK, your options are limited. The M1 rule set has little math capability, for example.

For more on rules, see:
http://www.cocoontech.com/index.php?showforum=50
 
Back
Top