Posts: 641
Threads: 119
Joined: Aug 2006
Doing all of your filtering in code will not break anything, but it will may bog the system down. The goal is to let Dean's filters eliminate most of the events you don't care about and then filter the last bit in code if necessary.
IsZoneAlarmFor will let you check a specific field and state (i.e. Elk.Physzone055 notready). Perfect for turning on a light when a door opens.
You could also use IsZoneAlarm and just check the state (notready). Then in your code you could filter for your specific field. This is less efficient because your code will be invoked every time any zone goes notready. Sometimes it is necessary to avoid replicating the code in your trigger lots of times though...
--Bob
P.S. Dean, the shipped code did not test the arm state. It just always sent violated. notready was never returned.
P.P.S. Of course neither Elk driver sends motion events yet...
Posts: 40,483
Threads: 491
Joined: Aug 2002
Oh, sorry. I forgot it didn't send motion events. It looks like I'm going to have to save the Elk reworking for early in the 4.3 phase. It's too late now in the cycle to take on something that substantial.
Dean Roddey
Explorans limites defectum
Posts: 659
Threads: 82
Joined: Nov 2007
So is it better to make a trigger for each elk zone with that filter or do 1 trigger like I am now and for actions check which elk zone was tripped?
Posts: 641
Threads: 119
Joined: Aug 2006
It depends on the code. If the code is substantial and similar, then use one trigger and detail filter in the action.
You need to try and filter as best you can before the action starts though. Use IsZoneAlarmFrom like Dean said, at least.
Don't forget your IsZoneAlarmFor = Elk.AreaAlarm1 filter will not work because IsZomeAlarmFor executes for PhysZone fields, not the AreaAlarm1 field.
--Bob
P.S. Its too bad the base Elk driver won't be upgraded for this release. Maybe you can just ship the dev driver. The base driver ZoneAlarm stuff is really broken and the longer its out there the more people will try to use it.
Posts: 659
Threads: 82
Joined: Nov 2007
So what filter do I want then for when the Elk system alarm goes off, whether Burglar, Emergency, Fire, etc?
Posts: 40,483
Threads: 491
Joined: Aug 2002
You would need to set up a field change trigger on the AreaAlarmXXX field for the area. Then use a field change filter for that field.
Dean Roddey
Explorans limites defectum
Posts: 641
Threads: 119
Joined: Aug 2006
You can also use an IsZoneViolated filter. Zones only go Violated when they are the cause of an alarm. This has the nice side effect of telling you which zone was responsible for the alarm.
Here is my alarm trigger (filtered by IsZoneViolated):
Code:
TrigEvent::GetZoneAlarmInfo
P1=LVar:State
P2=LVar:ZoneNumber
Devices::QueryDrvText
P1=Security
P2=ZoneName
P3=%(LVar:ZoneNumber)
P4=LVar:ZoneName
System::EMail
P1=ComcastBob
P2=trigger@ifttt.com
P3=$(Security.AreaAlarm1)
P4=%(LVar:ZoneName)
This causes my cell to get a text message whenever my alarm goes off.
NOTE: this trigger may execute more than once if more than one zone goes into alarm (as the burglar roams your house triggering sensors).
NOTE: this may not execute for zones which do not have fields. If you haven't enabled all your zones you may want to use the AreaAlarm field change trigger instead.
--Bob