The Power of Event Rules
Event Rules are essential in a GpsGate Server installation. They are used to trigger actions from inputs in the system.
Simply put Event Rules are used to make things happen in GpsGate Server. For example Event Rules are used to show an SOS alert on the map and to detect that a vehicle has entered or left a geofence.
Event Rules are triggered by events in the system, the most obvious event is a position update from a tracking device. Event Rules can be very simple, but you can also create more complex Event Rules from multiple signals for more advanced logic.
Another example is ECO reports that use Event Rules to collect harsh driving data. These Event Rules are automatically installed with the reports and they can be modified to customize the ECO Reports.
Event Rules are also used to send alerts over SMS and email to fleet managers and to send data to other systems over TCP/IP or http connections.
This is quite a lenghty post, but it is well worth reading.
Event Rule Wizard
The Event Rule wizard guides you through the different steps required to create an Event Rule. It goes from defining what Users the rule is for, what it does and finally what the output should be. Here are the steps described in more detail.
1. Rule name and description
Each Event Rule needs a name, and a description is good when you have a few rules. Use descriptive names as they are used in alerts and reports.
The option to turn the Event Rule on and off with the Enabled switch is used to control Event Rules that should either be enabled only occasionally, or if you need to disable a rule that is not properly configured.
2. Who this rule applies to
By default an Event Rule applies to all Users, but you can select a subset of Users for the Event Rule. This is for example used when you want different rules for different departments or different vehicle types.
Note: In this step the Users are the devices sending data to GpsGate Server. Operators and Administrator that should receive notifications are configured in step 5 below.
An Event Rule is evaluated for all the selected Users, so it is wise to exclude Users that never activate the rule anyway.
3. Schedule rule activity
Event Rules can be active at all times or based on a schedule. For example some rules should only be active during work hours, some rules might only make sense on weekends.
For the schedule there are three options set on a daily basis. You can set a time span, or have the rule active or inactive all day.
Usually Event Rules finish when a signal changes (more about that below). As shown above it is possible to end events automatically when a schedule ends without requiring any signal input.
The Expressions are used to start and end the events by evaluating incoming signals and position data. This is the section in the Event Rule wizard where you define the criteria for an event.
A simple Event Rule can have a single expression like “Start the Event when the Ignition signal is ON, and End it when the Ignition signal is OFF”. More complex rules can have multiple expressions like “Start the Event when the vehicle is moving faster than 30 km/h AND is in the SchoolArea geofence, and end it when the vehicle speed is below 25 km/h OR the vehicle has left the SchoolArea geofence”
An Event is started when the Expression(s) are True and when the Expression(s) turn False again the Event is closed. In cases where you setup complex rules you can close an event based on other End Expressions that you configure under Show advanced options.
You can trigger an event immediately or set a delay for a number of minutes before actually triggering the event.
The following Expressions are available:
|Analog Expression||Make comparisons on analog signal variables|
|Digital Expression||Make comparisons on boolean signal variables|
|Driver ID Login||Make driver logins on vehicles based on DriverID|
|Geofence Expression||Check if vehicles are inside or outside geofences|
|Job Expression||Start or finish Jobs when vehicles enter a Job location|
|Offline Expression||Check if devices are offline for a period of time|
|Points Of Interest||Check if vehicles are entering or leaving a Point of Interest|
|String Compare||Make comparisons on string signal variables|
This step is where you setup any notifications that the Event Rule should trigger. The sample below shows that an email will be sent to all Users in the Users Tag when the event starts and that a red icon will be shown in the Vehicle List when the Event Rule is active. As shown the email subject and message can be scripted using variables.
The following notifications are available:
|DriverID||Set the DriverID as a driver for a vehicle (used with the Driver ID Login expression)|
|Argument||Add an argument to the event icon shown on the map (used in step 6 below)|
|Command||Send a command to a tracking device or an external system over http or TCP/IP|
|Send an email to all Users in the recepient Tag|
|SMS||Send an SMS message to all Users in the recepient Tag|
|Icon||Display a colored icon in the Vehicle list to show the event state|
|Text||Display a text in the Vehicle list, like the idle time for a vehicle|
|Report Argument||Add arguments to Event Rule reports|
|JobNotifier||Used with JobExpression to set JobAssignmentState|
In this step you can decide if the events should show up on the map in VehicleTracker, or just be used for reports and external notifications. You can select if the events should close automatically when they finish, or if an Operator has to close them manually.
The event appearence is defined here. You can set the color, select a custom icon and add a Label (that you defined as an Argument notifier in the previous step).
If you enable the Notification area, new events will show up as a colored notificaton in the lower right corner of VehicleTracker.
Have a look at some examples and get more information about Event Rules here:
- Customize the Vehicle list with Event Rules
- Set vehicle attributes with Event Rules
- Displaying arguments on Event Rule reports
- Sample Camera Event Rule for Meitrack devices
- Http Expression vs. Command Notifier
- VIDEO: Event Rule for idle vehicles
- Configure Email Alerts using Gmail
- Speed Alerts in the Vehicle Panel
Discuss this blog post on the forum please