Event-Based Script
Event-based scripts execute when a group event occurs on the bus. They are particularly useful for real-time responses. To create an event-based script, follow these steps:
-
Click Event-based button in the Scripting tab → click the Add new script button.
-
Set the parameters in the Event-based script dialog as follows:
-
Script name: Provide a descriptive name for the script.
-
Group address/tag:
-
Manually enter group addresses (using digits from 0 to 15) or select from the drop-down list.
-
Group address format: Use digits and “/” as a separator (e.g., 1/1/1).
-
If tags are attached to group addresses, the script can run based on those tags.
-
-
Active: Set the script’s activation status (green for active, red for disabled).
-
Execute on group read: Choose whether to run the script with every group read.
-
Execution mode:
-
Normal: The event script runs each time it’s triggered.
-
First instance only: Does not start a new script (PID) if it’s already running.
-
Last instance only: Stops all running scripts and PIDs, executing only the last one triggered. Commonly used when saving the current PID into storage.
-
-
Category: Assign the script to a new or existing category. This helps organize scripts in the Print script listings page under Tools.
-
Description: Add a brief description of the script.
-
If the script runs only on a read request, consider using the following example:
if event.type == 'groupread' then
-- Your script logic here
end