Overview
This guide provides practical programming examples to help understand how to fully utilise the Integriti controller’s macro engine, general variables, time periods, and auxiliaries. Macros are powerful automation scripts that run on the controller, enabling custom logic without external software.
Prerequisites
- Integriti System Designer with installer-level access.
- Understanding of Integriti macros, general variables, time periods, auxiliaries, and named actions.
- Controllers running firmware that supports macros (all current versions).
Example 1: Flashing Auxiliaries During a Time Period
Goal: Toggle an auxiliary every 5 seconds. Every fifth toggle, turn on a second auxiliary for 10 seconds. Only run while a time period is valid.
Entities Used
- 1× General Variable
- 1× Macro
- 1× Time Period
- 2× Auxiliaries
Entity Configuration
- Time Period: “Working Hours” — 09:00 to 17:30 Monday to Friday.
- General Variable: “Example Counter” (GV1), test value set to 4.
- Auxiliaries: C01:X01 “Flasher 1” and C01:X02 “Flasher 2”.
Macro: Example 1
| # | Statement | Configuration |
|---|---|---|
| 1 | Wait for Condition… | Expression: TP1 |
| 2 | Do an Action | Action: Control Aux; Auxiliary: C01:X01; When Asserted: Toggle |
| 3 | Pause for Time… | Expression: 50 |
| 4 | Set Entity To Expression… | Expression: GV1+1; Entity to Set: GV1 |
| 5 | Goto | Expression: !GV1; Label: SkipOn |
| 6 | Do an Action | Action: Control Aux; Auxiliary: C01:X02; On Time: 00:00:10 |
| 7 | Set Entity To Expression… | Expression: 0; Entity to Set: GV1 |
| 8 | Define a Label | Label: SkipOn |
Statement Summary
- Wait for Condition: Prevent further execution until time period TP1 (Working Hours) is valid.
- Toggle Flasher 1: Inverts the state of auxiliary C01:X01 each time this statement executes.
- Pause: 50 × 100ms = 5 seconds.
- Increment Counter: GV1 = GV1 + 1.
- Conditional Skip: If GV1 does NOT return true (value ≤ 4), skip to label “SkipOn”. The expression
!GV1tests if GV1 is not above its test value. - Turn on Flasher 2: C01:X02 turns on for 10 seconds. When a non-zero “On Time” is specified, the auxiliary turns off after that time.
- Reset Counter: GV1 = 0.
- Label: Target for the goto in step 5.
- Macro returns to step 1 (loop continues indefinitely while time period is valid).
Example 2: Random Bag Inspections
Goal: During working hours, randomly deny access to users at a specific door. A supervisor can reset the random check.
Entities Used
- 1× Door
- 1× General Variable
- 1× Input
- 1× Named Action
- 1× Reader Module
- 1× Time Period
- 2× Macros
- 2× Permission Groups (“Employees”, “Supervisors”)
- 2× Users (“Employee”, “Supervisor”)
Entity Configuration
- Door: “Door x” as a normal entry door with reader module “Reader x”.
- Time Period: “Working Hours” — 09:00 to 17:30 Monday to Friday.
- General Variable: “Random inspection” (GV2) — assigned a random number to determine user access, reset to zero by supervisor.
- Named Action: “Start random bag” — triggered by Door x when working hours are valid; starts macro “Random bag” each time Door x opens.
- Input: “Reset bag” — attached to a supervisor button; starts macro “Reset random bag”.
Macro Statements
Macro: Random bag
| # | Statement | Configuration |
|---|---|---|
| 1 | Set Entity To Expression… | Expression: 8388607; Entity to Set: GV2 |
| 2 | End Current Macro |
Macro: Reset random bag
| # | Statement | Configuration |
|---|---|---|
| 1 | Set Entity To Expression… | Expression: 0; Entity to Set: GV2 |
| 2 | End Current Macro |
Statement Summary
- Random bag: GV2 is assigned the value 8388607 — a “magic number” that causes the entity to be given a random number between 1 and 8388067.
- Random bag ends, stopping the macro.
- Reset random bag: GV2 is set to 0, clearing the random inspection flag.
Integration Notes
- The door’s access logic checks GV2 — when the random number is above a threshold, access is denied (prompting a bag inspection).
- The supervisor presses the “Reset bag” input to clear GV2 and allow the denied user through.
Verification
- Example 1: Start the macro while Working Hours are valid — verify Flasher 1 toggles every 5 seconds and Flasher 2 activates every 5th toggle for 10 seconds. Outside working hours, the macro should pause.
- Example 2: Badge at Door x during working hours — verify access is randomly denied. Press the supervisor reset button — verify the next access attempt is granted.
Troubleshooting
| Problem | Resolution |
|---|---|
| Macro not running | Verify the macro is started (manually or via Named Action). Check that Wait for Condition expressions are satisfied. |
| Auxiliary not toggling | Verify the auxiliary entity ID is correct (e.g., C01:X01). Check Control Aux action configuration. |
| Random inspection always denying | Verify GV2 threshold logic in the access group. Check that “Reset bag” input correctly sets GV2 to 0. |
| Pause timing incorrect | Pause values are in units of 100ms. E.g., 50 = 5 seconds. |