CheckTrigger

callback.CheckTrigger trigger As String

 

When your plug-in detects an event that may cause a trigger, you need to call back into HS with a formatted trigger string.

 

The trigger string passed to this function contains values that will be compared with the selected values of your trigger controls as added with the function TriggerUI(). In our example, we added 3 controls, so we therefore have to pass back 3 values which represent each control. HS will perform matches on the values and trigger the event if all the values match a trigger.

Note that there may be times when you want HS to ignore a value. In our examples one of our controls is a text box which is being used to hold comments. We do not want HS to attempt a match on this value. In this case, pass back an “*” for the value and HS will not attempt a match on it.

The trigger string is a Chr(2) separated list of values with the following format:

Parameter 0:  plugin name

Parameter 1: trigger name (as given in TriggerUI)

Parameter 2+N: list of trigger values for each control

 

Following on the previous examples, the following trigger string would force HS to match our trigger that was previously configured:

"ACME Security Panel" & Chr(2) & "Panel Trigger" & Chr(2) & "zone 1" & Chr(2) & "Closed" & Chr(2) & “*”

 

If you have triggers using a range of values, see PreCheckTrigger.

Note the “*” as the last parameter which tells HS to not perform a match on this value, as this is the position where the Notes field was on the TriggerUI definition.
Tip: Using an EventEnumerator object in a script or program, look for events with non-empty pi_trigger property values, replace Chr(2) with a printable character, and write the trigger string to a file (or the HomeSeer log) if you want to see how some of the trigger strings are put together.