Alarms - Extending¶
Email notifications¶
To send alarm notifications by email, an SMTP server must be configured. This can be done in WideQuick® Designer before deployment or in WideQuick® Runtime on a running system.
Configuring SMTP in WideQuick® Designer¶
- In the project tree, right-click the Mail node and select Properties....
- Enter the server details.
Configuring SMTP at runtime¶
Click Configure in the SMTP section of the Alarm - Schedule status panel, or call System.mailManager.edit() from a script or button action.
| Field | Description |
|---|---|
| Sender | Sender email address |
| Sender Name | Display name for the sender |
| Server | SMTP server address or IP, for example smtp.gmail.com |
| Port | Server port |
| Domain | Server domain |
| User | Account username |
| Password | Account password |
Email aliases¶
The alias system maps a short keyword to one or more email addresses. Aliases can be selected when adding recipients to a notification schedule, making it easier to manage recipient groups centrally.
Aliases are managed in the Edit mail settings dialog alongside the SMTP configuration.
Customize emails¶
The email notification is built as a plain text message. The layout and content can
be customized by editing the writeMail() function in the scAlarmSender script.
The default email format looks like this:
---------------------------------------------------------------------------
| Schedule: My Schedule
| Subject: My Subject
| Event: Alarm acknowledged (active)
---------------------------------------------------------------------------
| ------------------------------------------------------------------------
| | Name: AS01.Station1_PV01_IO
| |
| | Timestamp: 2026-05-29 12:00:00
| |
| | Alarm class: 1
| |
| | Alarm text: My alarm text
| |
| | Description: My alarm description
| |
| | Acknowledged by: Operator
| ------------------------------------------------------------------------
|
---------------------------------------------------------------------------
Description is only included when the alarm has one, and Acknowledged by only when a user is known. When the schedule reacts to all events, the Event line is written for each alarm instead of in the header.
Each line in the email is built by adding text to a message variable using +=.
This means the integrator can change the labels, add new lines of plain text, or
remove lines they do not need. For example, to change the Alarm class label to
Priority, locate the following line in the writeMail() function:
msg += "| | " + Language.translate("Translations.klib", "Larmklass") + ": " + alarm.severity + "\n"
And change it to:
The labels are passed through Language.translate(), so a label can also be changed
without editing the script by changing its translation. See
Editing Individual Translations.
A translation applies everywhere the same source text is used.
The available alarm fields that can be included in the message are:
| Field | Description |
|---|---|
alarm.name |
The name of the alarm |
alarm.timestamp |
The date and time the event was processed for the notification. For an acknowledgement, this is close to the time of acknowledgement, not when the alarm was triggered |
alarm.severity |
The alarm class |
alarm.text |
The alarm text |
alarm.description |
The alarm description. Empty if the alarm has none |
alarm.eventType |
The event: active, acknowledged, unacknowledged or inactive |
alarm.username |
The user behind the event, if known |
alarm.active |
true if the alarm is active |
Plain text can also be added freely anywhere in the message. For example, to add a footer, add the following line before the closing separator:
SMS notifications¶
SMS notifications are sent via a modem connected to the WideQuick host over a serial COM port. This can be a traditional GSM modem or a 4G router. Any device that accepts AT commands over a serial connection is compatible.
Alternatively, SMS can be sent through a Teltonika router with the Teltonika plug-in. The
plug-in talks to the router's REST API over the network instead of a serial connection,
and sends SMS for the same alarm notification schedules. The plug-in hooks into
scAlarmSender, so SMS go through the router instead of the GSM modem. It runs on Windows only and
requires a WideQuick Advanced license with the .NET plug-in option, or a Premium
license. See Send SMS with Teltonika.
Configuring the modem¶
The modem is configured in WideQuick® Runtime. Navigate to
Settings → Advanced settings → GSM Modem and click Change GSM settings to open
the configuration dialog. The advanced settings require the Debug privilege. While GSM
is switched on, the dialog can also be opened with Configure in the SMTP and GSM
section of Alarm - Schedule.
Enter the connection parameters from the device's data sheet:
| Field | Description |
|---|---|
| Com port | Serial port the modem is connected to |
| Baudrate | Communication speed |
| Data bits | Number of data bits |
| Stopbits | Number of stop bits |
| Parity | Parity setting |
| Flow control | Flow control method |
| Pin | SIM card PIN, if required |
Click Save. If the configuration is correct the GSM Modem Active indicator turns green. GSM itself is switched on and off with the GSM Modem toggle on the same tile in Settings.
Requirements
SMS notifications require scModem to be running in addition to scAlarmSender.
Customize SMS¶
The SMS notification follows the same pattern as the email and can be customized by
editing the writeSMS() function in the scAlarmSender script. The same alarm fields
are available. Labels can be changed or plain text added in the same way.
The default SMS format looks like this:
Schedule: My Schedule
Title: My Subject
Event: Alarm acknowledged (active)
Name: AS01.Station1_PV01_IO
Timestamp: 2026-05-29 12:00:00
Alarm class: 1
Alarm text: My alarm text
Description: My alarm description
Acknowledged by: Operator
With Compact mode switched on for the schedule, the SMS contains only the title and,
for each event, the names of the matching alarms. A schedule whose sms_truncated
column is set to 1 sends only the number of new alarms. This option has no setting in
the views.
For example, to change the Name label to Signal, locate the following line
in the writeSMS() function:
msg += Language.translate("Translations.klib", "Namn") + ": " + Language.translate("Translations.klib", alarm.name) + "\n"
And change it to:
msg += "Signal: " + Language.translate("Translations.klib", alarm.name) + "\n"
Note
Keep SMS messages short. Most GSM modems have a character limit per message, and long messages may be split into multiple parts or truncated.
Remote alarm aggregation¶
Alarms from connected remote systems can be aggregated into the local alarm list. See Remote Alarms in the Remote Systems guide for setup instructions.


