# Alerts

The behavior of almost every **mode-specific event** sent as an uplink message by all API 6 user modes (with the exception of Stupid modes) can be further fine-tuned using a feature we call **Alerts**. Using alerts, you can customize how many messages and frames are sent, if events request downlink or disarm the device and how they are indicated by the LED and the beeper. You can also set up event repetition.

### **Introduction**

Alerts are event extensions that allow various additional settings and can enable and customize event repetitions. In every user mode, up to 3 mode-specific events are predefined in the API 6 code to be alerts 1-3 (you **cannot** assign an alert number to an event manually). This allows you to choose one mode-specific event from a user mode you want to use and modify its behavior.

*Example:* [*Trace me user mode (0x04)*](https://ask.simplehw.eu/kb/simple-api-6-generation/modes/api-6-standard-user-modes_15400961) *events and their respective alerts*

| ***Event name (hex)***     | ***Assigned alert number*** |
| -------------------------- | --------------------------- |
| *Start of movement (0x20)* | *1*                         |
| *End of movement (0x21)*   | *2*                         |
| *Tracing tag (0x22)*       | *3*                         |

### **Alert settings**

Every alert is controlled by four registers - a total of 12 *registers* (**from 0x23 to 0x2E**).

**Alert configuration** is controlled by registers **0x23**, **0x26** and **0x29** for **Alerts 1, 2** and **3** respectively.\
The 8 binary flags (bits) of this **one***-***byte value** modify the following:

| **Bit** | **Set to 0**                     | **Set to 1**                                                                                     |
| ------- | -------------------------------- | ------------------------------------------------------------------------------------------------ |
| **7**   | Single message                   | Message sent three times                                                                         |
| **6**   | Uplink only alert message        | [*Alert message requests downlink*](https://ask.simplehw.eu/kb/simple-api-6-generation/downlink) |
| **5**   | No change to device status       | Disarm after alert is sent                                                                       |
| **4**   | Standard 3 frames transmitted    | Only one frame message will be sent                                                              |
| **3**   | Short beep indication turned off | <p>Short beep indication turned on,<br>bit 1 set to 0 has a higher priority than this</p>        |
| **2**   | LED indication turned off        | LED indication turned on                                                                         |
| **1**   | Beeper indication turned off     | Beeper indication turned on                                                                      |
| **0**   | (empty)                          | (empty)                                                                                          |

*Example: If you set the Alert 1 configuration register (0x23) to value 0x82 (10000010) while using the Trace me user mode (0x04) above, the device would beep when movement is detected and a Start of movement event (0x20) would be sent three times.*

***

**Alert repetition interval** registers (**0x24, 0x27** and **0x2A** for **Alerts 1, 2** and **3** respectively) control the time period to resend the alert event (the event will only be resent if you’ve defined the number of repetitions). The values of these registers are encoded as a [*SimpleTime*](https://ask.simplehw.eu/kb/simple-api-6-generation/api-6-encoding_23396515/simpletime) value in a single byte.

**Alert number of repetitions** registers (**0x25**, **0x28** and **0x2B** for **Alerts 1, 2** and **3** respectively) control how many repeated event messages will be sent (the events will only be repeated with a repetition interval defined). The values of these registers are just numbers without any special encoding. Up to 256 repeated event messages can be sent (the device will still send one event even with value set to 0x00).

*Example: If you set the Alert 1 repetition interval register (0x24) to 1 minute (0x41) and the Alert 1 number of repetitions register (0x25) to 10 (0x0A) while using the Trace me user mode (0x04) above, you would receive a Start of movement event (0x20) once the movement is detected and then every minute for a total of 11 messages (1 original and 10 repeated ones).*

***

**Alert delay** registers (**0x2C**, **0x2D** and **0x2E** for **Alerts 1, 2** and **3** respectively) control the delay of the event - the time from detecting an event trigger to the event being actually sent.

*Example: If you set the Alert 1 delay register (0x2C) to 1 minute (0x41) while using the Trace me user mode (0x04) above, you would receive a Start of movement event (0x20) one minute after movement was detected.*
