---
title: Event configuration
slug: reference/event-configuration
docTags: 
createdAt: 2025-09-08T10:38:05.191Z
---

Once the event types with their accompanying event properties are set up, event types can be linked to assets to start configuring the event detection. First select an asset from the asset tree and click `Configure event`:

Next, the detection mode can be chosen to be either `Historian`, `Schedule`, `Manual`, or `External Database`. The different detection modes are elaborated [below](docId\:DS_e9HUV8qe7bNgq4y3cd) .

Optionally, a parent event configuration can be given. It is recommended that the parent event configuration is of the same event type as the parent event type configured on the selected event type.

Once created, the event detection of this event configuration can be started or paused (except event configurations with `Manual` detection mode).&#x20;

:::hint{type="info"}
Newly created event configurations are paused by default. They need to be started by clicking the Start button.
:::

Once the event detection has started for this event configuration, the detected events of this event configuration and their event properties can be found in the Events tab, or in the [Events overview](docId\:d4QgasozTs1L3j3kMe05T). In a similar fashion the logs pertaining to this event configuration can be found in the Logs tab.

## Detection mode

A trigger measurement can be used by opting for `Historian` as the detection mode or a recurring schedule can be used by opting for `Schedule` as the detection mode.

### Detection mode: Historian

The historian detection mode works by observing the values of a `trigger measurement` for a change. Whenever the value of the trigger measurement changes, that timestamp is used to start a new event, along with closing the previously open event on the same timestamp. Take into account, if the new value of the measurement is considered a zero value (depending on the datatype), the previous event will be stopped but a new event will not be created.

**Zero values**

The values considered as zero values with respect to event detection for each datatype are listed below.

- `boolean`: false
- `number`: 0
- `string`: "" (an empty string)

**Refresh interval**

To prevent the creation of an event with an incorrect start time the event detection will only start creating new events after the first change in value is detected. The refresh interval at which the detection is evaluated can be adjusted by using the `refresh interval`.

**Grace period**

To ignore value changes and consequently triggering a new event, a grace period can be configured. If a value changes and subsequently the value changes back to the former value within the grace period, the current event will not be closed and no new event will be started. Thus, the grace period is the time period for which value changes are ignored or can be seen as the minimum time between value changes.

**Example historian event detection**

An example of the historian detection mode by observing the values of the trigger measurement “BATCH\_LABEL”:

| Value | Time             | Event detection             |
| ----- | ---------------- | --------------------------- |
| 5AB   | 2006-05-04 12:59 | start of event-detection    |
| 5AB   | 2006-05-04 13:00 | no action                   |
| 5AB   | 2006-05-04 13:01 | no action                   |
|       | 2006-05-04 13:02 | close previous event        |
| 16BA  | 2006-05-04 13:03 | open new event              |
| 16BA  | 2006-05-04 13:04 | no action                   |
| 17B0  | 2006-05-04 13:05 | close event, open new event |
|       | 2006-05-04 13:06 | close event                 |
| 17BA  | 2006-05-04 13:07 | open new event              |

This results in the creation of 3 new events:

| Event | Start time       | Stop time        |
| ----- | ---------------- | ---------------- |
| 1     | 2006-05-04 13:03 | 2006-05-04 13:05 |
| 2     | 2006-05-04 13:05 | 2006-05-04 13:06 |
| 3     | 2006-05-04 13:07 | ongoing          |

### Detection mode: Schedule

The schedule detection mode allows for generating events based on a recurring schedule. By means of an RRULE, this event detection can be configured. An RRULE is a recurrence rule which defines a pattern to generate a set of timestamps to setup new events. Their syntax is defined by the [rfc5545](https://datatracker.ietf.org/doc/html/rfc5545) standard.

To set up a schedule event detection, add a recurrence rule for generating a set of start timestamps and optionally add another recurrence rule to close the corresponding events. Multiple recurrence rules can be combined for either the start timestamps and/or the stop timestamps. One recurrence rule for the start timestamps is required.

**Example schedule event detection**

An example of the schedule detection mode to generate a set of start and stop timestamps for new events:

**Start rules**

:::hint{type="info"}
DTSTART;TZID=Europe/Brussels:20200101T080000

RRULE\:FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR

DTSTART;TZID=Europe/Brussels:20200101T140000

RRULE\:FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
:::

**Stop rules**

:::hint{type="info"}
DTSTART;TZID=Europe/Brussels:20200101T220000

RRULE\:FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
:::

This results in the creation of 2 new events per weekday:

| Event | Start time       | Stop time        |
| ----- | ---------------- | ---------------- |
| 1     | xxxx-xx-xx 08:00 | xxxx-xx-xx 14:00 |
| 2     | xxxx-xx-xx 14:00 | xxxx-xx-xx 22:00 |

For further information on RRULE including a useful GUI to build a recurrence rule, visit [RRULE ui](https://jkbrzt.github.io/rrule/) .

### Detection mode: manual

The manual event detection mode allows for events to be manually started/stopped inside manual entry forms. No further configuration is needed for this detection mode.

### Detection mode: External database

The external database detection mode works by querying a database for start and stop times to generate events. [External databases](docId\:vIYeTHLgnIsQRjVtrc6Op) can be configured by going to `Configuration > External Databases`.

The query must return a table with exactly one or two columns, and every column value must be a timestamp. A third column, or a column of any other type, makes the whole detection run fail. The first column should contain the start times of the events, the second column (if it is present) should contain the stop times of the events.
If only start times are available in the dataset, the stop time for an event will be based on the start time of the following event.
This detection mode has a required refresh interval, given as a duration literal of at least 1s, which determines how often the query runs.

You can use query parameters to narrow down your data selection, which includes the asset metadata. The supported parameter values are `CurrentTime`, `LastEvaluationTime`, `AssetName` and asset metadata keys. For example, given the following database table `event_times`:

| Type  | Start time       | Stop time        |
| ----- | ---------------- | ---------------- |
| Pump1 | 2024-12-27 08:00 | 2024-12-27 14:00 |
| Pump2 | 2024-12-27 09:00 | 2024-12-27 15:00 |

We can create this query to generate events for a specific asset type:

```pgsql
SELECT start_time, stop_time FROM event_times
WHERE type='Pump1' AND stop_time < $1
```

![](https://app.archbee.com/api/optimize/SMPo4IS9FkillUAMsur2c/SoTn9wyKovmNUu_tAXTkb-20250926-071640.png "Configure the Current Time as a parameter")

We can create more dynamic queries, based on asset metadata:

```pgsql
SELECT start_time, stop_time FROM event_times
WHERE type=$1 AND stop_time < $2
```

![](https://app.archbee.com/api/optimize/SMPo4IS9FkillUAMsur2c/RNZGVakxs-YdKB9wDS0w8-20250926-071742.png "Configure asset metadata as a parameter")

If no stop times are available we can omit that column:

```pgsql
SELECT start_time FROM event_times WHERE start_time < $1
```

## Re-evaluation of events

By selection an asset in the asset tree and clicking the re-evaluate button in the top right corner, all events underneath that asset can be re-evaluated for the indicated time period. In this way, events can be detected on already existing historian time series data.

Note that this will not overwrite events which have been edited by hand (flagged `manual`), nor will interfering existing events be deleted unless the option ‘delete previously generated events’ is selected in the re-evaluation popup.

To re-evaluate only one event, see [re-evaluate a single event](docId\:d4QgasozTs1L3j3kMe05T).

## Pausing and resuming

Event configurations can be paused to stop the detection of any future events. This can be done by clicking the "Pause" button in the top right corner of the asset details page. This button will then change to a "Start" button, which can be used to resume the event configuration and start detecting new events.
