> For the complete documentation index, see [llms.txt](https://docs.widgelix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.widgelix.com/actions-formerly-rule-engine/creating-an-action.md).

# Creating an Action

This page walks through the action editor from top to bottom. The example used in the screenshots is a **Warning** action that fires when a greenhouse sensor reports a temperature above 30 °C for 10 minutes while humidity is above 70 %, and sends an email.

## Step 1: Open the editor

Go to **Actions** in the left sidebar and click **+ Add action**. To change an existing action, click its name in the list. The editor of an existing action has a **Save** and a **Delete** button at the bottom.

Click **Show Help Guide** at the top of the editor for a short reminder of the main concepts.

## Step 2: General settings

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2Fa4o0hhdP1vz733i3WbZU%2Fcreate-action-general.png?alt=media&amp;token=934ff19a-8fc3-4113-b51c-744181187b05" alt="Create Action general settings"><figcaption><p>General settings and Action Behavior Settings</p></figcaption></figure>

| Field              | Required | Description                                                                                                                                                |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action Name**    | Yes      | A unique, descriptive name, e.g. `Greenhouse - High Temperature` or `Low Battery Warning`.                                                                 |
| **Alert Type**     | Yes      | Severity of the generated event: **Info** (informational), **Warning** (attention needed) or **Danger** (critical issue, shown as *Critical* in the list). |
| **Custom Message** | No       | Overrides the default event message. Placeholders are **not** supported here; use them in the message of a THEN action instead.                            |
| **Pass Payload**   | No       | Includes the full asset payload in notifications. Useful for debugging or detailed logs.                                                                   |

## Step 3: Action Behavior Settings

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FJCHlnUNV1ehJgJIn4Hpa%2Fbehavior-settings.png?alt=media&amp;token=46f8a8ba-fbb6-43ce-9128-93f3af89697a" alt="Action Behavior Settings"><figcaption><p>Action Behavior Settings with Action Dependencies enabled</p></figcaption></figure>

#### Enabled (default: on)

Disabled actions are completely inactive and do not trigger any notifications. Use it, for example, to pause an action during maintenance. You can also toggle this directly in the actions list.

#### Trigger Once (default: off)

The action fires once and then waits until the condition becomes false before it can fire again.

> Example: `Temperature > 30 °C` fires once. It will not fire again until the temperature drops below 30 °C and rises above it again.

#### Execute Every (Rate Limiting) (default: on, 15 minutes)

The action cannot execute more often than the selected interval, even if the condition stays true: **1 minute**, **5 minutes**, **15 minutes**, **30 minutes**, **1 hour** or **1 day**. This is useful for sensors that report very often when you only want, say, hourly alerts. Combine it with *Trigger Once* for maximum control over notification frequency.

#### Action Dependencies (Alert Suppression) (default: off)

Suppresses this action's notifications while one of the selected **parent actions** is triggered, with an optional **Hold window**. See [Action Dependencies](https://docs.widgelix.com/actions-formerly-rule-engine/action-dependencies.md).

## Step 4: Add conditions (IF / IS)

Click **+ Add Trigger** (or **+ Add Condition** for further statements). The **Configure Condition** panel opens on the right.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2Fk9LZdpRfZOrVraFZP2hx%2Fcondition-if.png?alt=media&amp;token=af811b8c-e7a8-43dd-bf6b-3a37a8599484" alt="Configure Condition panel, IF configuration" width="380"><figcaption><p>IF configuration</p></figcaption></figure>

### IF configuration: what to monitor

| Field                          | Required | Description                                                                                                                                                                            |
| ------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Asset Template**             | Yes      | The asset template (formerly device type) of the assets to monitor.                                                                                                                    |
| **Asset goes offline**         | No       | Fires when a selected asset goes offline. Data field and comparison are not required.                                                                                                  |
| **Gateway connectivity alert** | No       | **None** (default), **Gateway goes offline** or **Gateway goes online**. Use separate actions for the offline and the online transition. Requires the Widgelix LoRaWAN Network Server. |
| **Data Field**                 | Yes      | The telemetry field to evaluate, e.g. `temperature`, `humidity`, `batteryVolt`. The list comes from the asset template's decoder.                                                      |
| **Asset Selection Method**     | Yes      | **Select from list** or **Select from map** (pick assets on a map).                                                                                                                    |
| **Assets**                     | Yes      | One or more assets. Choose **All** to monitor every asset of the template.                                                                                                             |

### IS configuration: what value to check

**Comparison Type**:

* **Compare with constant**: compare the reading with a fixed value. See [Compare with constant](https://docs.widgelix.com/actions-formerly-rule-engine/condition-types/compare-with-constant.md).
* **Compare with asset measurement**: compare the reading with the live value of another asset. See [Compare with asset measurement](https://docs.widgelix.com/actions-formerly-rule-engine/condition-types/compare-with-asset-measurement.md).
* **Geofence**: check whether the asset is inside or outside one or more areas drawn on a map. See [Geofences](https://docs.widgelix.com/actions-formerly-rule-engine/condition-types/geofences.md).

**Comparison Operator**: Less Than, Less Than Or Equal, Equal, Greater Than Or Equal, Greater Than, Not Equal, In Range, Out Of Range. See [Comparison Equations](https://docs.widgelix.com/actions-formerly-rule-engine/comparison-equations.md).

**Value**: the threshold. *In Range* and *Out Of Range* ask for a minimum and a maximum.

### Switching threshold range (hysteresis)

Prevents alerts from flickering when a value hovers around the threshold. After the condition fires, the value must first satisfy the **Reset comparison** / **Reset threshold** before the condition can fire again.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FR5L7IIfPAPAHdE8lbGiw%2Fcondition-hysteresis-temporal.png?alt=media&amp;token=11f52ec4-3ac1-4463-a95f-dbc013f14330" alt="Switching threshold range and Temporal control" width="380"><figcaption><p>Switching threshold range and Temporal control</p></figcaption></figure>

> Example: trigger when `temperature > 30`, reset when `temperature < 27`. The action fires above 30 °C and cannot fire again until the reading has dropped below 27 °C.

Reset comparison options: Less Than (default), Less Than Or Equal, Equal, Greater Than Or Equal, Greater Than, Not Equal. Available for *Compare with constant* and *Compare with asset measurement*.

### Temporal control

Requires the condition to stay true for a **Persist duration** (default 10 minutes) before it counts, with optional **Ignore short spikes** and **Reset after prolonged violation**. Not available for offline alerts. See [Temporal Control](https://docs.widgelix.com/actions-formerly-rule-engine/temporal-control.md).

Click **Apply** to save the condition or **Cancel** to discard it.

### Combining conditions

Each condition appears as a **Statement** card that summarizes the IF / IS logic (and the temporal duration, if set). Click a card to edit it, or the bin icon to remove it.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FwSACwdBYcUM8kSAk78us%2Fstatements.png?alt=media&amp;token=242fb8fb-d562-4492-94e5-e611c3fab2cb" alt="Two statements combined with AND"><figcaption><p>Two statements combined with AND</p></figcaption></figure>

You can add up to **10 conditions** per action. Between two statements choose **AND** (both must be true) or **OR** (either is enough).

## Step 5: Add THEN actions

Below the conditions, in the **THEN** section, every new action starts with **Event Only** (the event is logged in Widgelix without sending anything). Click **+ Add Action** to add a notification or command.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2F3Ww7PEjCPLwrEJQTEOsR%2Fselect-action-type.png?alt=media&amp;token=a472ae9a-7c68-4d2b-b083-e789842ae34a" alt="Select Action Type dialog"><figcaption><p>Select Action Type</p></figcaption></figure>

Available types: **Email**, **Discord**, **Slack**, **Webhook**, **SMS**, **Signl4**, **Downlink** and **Event Only**. You can add several THEN actions to one action, and use **← Change Action Type** inside the dialog to switch types. Field details and message placeholders are described in [Action Types & Placeholders](https://docs.widgelix.com/actions-formerly-rule-engine/action-types-and-placeholders.md).

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FkN3FA67nrjl6sAxBluE4%2Faction-email.png?alt=media&amp;token=4b76e525-a90a-45a2-966b-a7ef74d6915e" alt="Email action with placeholders"><figcaption><p>Email action with placeholders in the message</p></figcaption></figure>

## Step 6: Escalation chain (optional)

Turn on **Escalation chain** below the THEN actions to assign the alert to people step by step and escalate it when nobody acknowledges it in time. See [Escalation Chain](https://docs.widgelix.com/actions-formerly-rule-engine/escalation-chain.md).

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FNAFzqUyZrBDQlGrfdQPj%2Fthen-escalation-schedule.png?alt=media&amp;token=fdcfa894-d826-494b-9e0a-d55f0e9b2f03" alt="THEN actions, escalation chain and schedule"><figcaption><p>THEN actions, Escalation chain and Schedule</p></figcaption></figure>

## Step 7: Schedule (optional)

The **Schedule** card at the bottom restricts when the action is allowed to execute. By default it shows **Any time**. Click the card to open **Configure Schedule**.

<figure><img src="https://2494440469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggsr9Xlsze5cwVr4WMof%2Fuploads%2FiPZr3f8S4elrA41L4dr9%2Fschedule.png?alt=media&amp;token=b6548bee-6472-456b-9219-6fa07a23d7b2" alt="Configure Schedule panel"><figcaption><p>Schedule limited to working days, 09:00 to 18:00</p></figcaption></figure>

* **Any day (no schedule restrictions)**: when on (default), the action runs 24/7.
* Turn it **off** to show the weekly timeline (00 to 23 hours, one row per day).
* Quick buttons: **Select All**, **Clear All**, **Business Hours (9-18)**.
* Tick the checkbox of a day to enable it, then **click and drag** across its row to select the active hours. The timeline snaps to 30-minute steps.
* For exact times, **right-click** the time range on the right of a row and choose **Edit Time** (enter `HH:MM` start and end) or **Copy to All Days**. The small toggle next to each day's time range opens a precise time input for that day.

Click **Apply**. The Schedule card then shows the active days and hours.

## Step 8: Save

Click **Save Action** (or **Save** for an existing action). Required fields that are missing (for example Asset Template, Data Field, Assets, Parent actions or Reset threshold) are highlighted in red and must be fixed before saving.

## Checklist

* [ ] Action Name and Alert Type set
* [ ] Behavior settings reviewed (Enabled, Trigger Once, Execute Every, Action Dependencies)
* [ ] At least one condition with Asset Template, Data Field, Assets, operator and value
* [ ] Optional: switching threshold range and temporal control
* [ ] At least one THEN action (or Event Only)
* [ ] Optional: escalation chain and schedule
