> For the complete documentation index, see [llms.txt](https://docs.akenza.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.akenza.io/device-management/rule-engine/timed-rules.md).

# Timed Rules

Run a rule on a fixed schedule instead of on every new data sample.

A **timer** runs a rule on a fixed schedule. The rule logic is then evaluated at set times, in addition to when new data arrives.

To add a timer, click **Add timer** at the bottom of the rule detail view.

<figure><img src="https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FEPz1sF96mxDBxDFFGPq3%2Fscreely-1685032992008.png?alt=media&amp;token=cbcee4a9-dbef-4433-b5fa-f587fbb60edc" alt="The Add timer button at the bottom of the rule detail view"><figcaption><p>Adding a timer to a rule</p></figcaption></figure>

{% hint style="warning" %}
Timed rules only support devices as [input](/device-management/rule-engine/rule-input.md). A rule with a tag or tag combination input is aborted when its timer triggers it.
{% endhint %}

## Timer modes

The timer configuration offers three modes:

{% tabs %}
{% tab title="Interval" %}
Runs the rule every few minutes, hours, or days. The next run is always the next upcoming interval.

<table><thead><tr><th width="140">Interval</th><th>Aligned to</th><th>Example</th></tr></thead><tbody><tr><td><strong>Minutes</strong></td><td>The hour</td><td>A 10 minute interval runs at XX:00, XX:10, XX:20, and so on.</td></tr><tr><td><strong>Hours</strong></td><td>The day</td><td>A 6 hour interval runs at 00:00, 06:00, 12:00, and 18:00.</td></tr><tr><td><strong>Days</strong></td><td>Midnight UTC</td><td>Runs every day at 00:00 UTC.</td></tr></tbody></table>
{% endtab %}

{% tab title="Fixed" %}
Runs the rule every day at the selected time, starting on the day after the selected start date.
{% endtab %}

{% tab title="Advanced" %}
Runs the rule on a [Quartz cron expression](https://www.freeformatter.com/cron-expression-generator-quartz.html) in UTC. Use it for schedules the other modes cannot express.
{% endtab %}
{% endtabs %}

## Output templating

A timer is not a device, so a timed run has no current data sample. The `{{data.*}}` property and all other properties of the current sample are not available in the [payload templates](/reference/message-templating.md) of the rule actions.

Use `{{dataSources.X.*}}` instead. Data sources always resolve to the latest stored sample of their device. A data source whose device has not stored any data yet is not resolved.

See [Data Source Properties](/reference/message-templating.md#data-source-properties) for all available properties.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.akenza.io/device-management/rule-engine/timed-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
