# Time Restrictions

## Overview

This document provides an overview of the **Time Restrictions** feature within the **Datacake Rule Engine**. This feature allows users to specify time frames during which particular actions within a rule are permitted to trigger. If an action's associated time restriction is not met, the action will not execute, even if the rule's conditions are satisfied.

### Practical Use Cases

* **Work Shift Notifications**: Set up rules to notify specific team members based on shift times.
* **Off-Hours Monitoring**: Limit notifications to business hours or specific time frames to reduce unnecessary alerts outside working hours.
* **Daily or Weekly Alerts**: Schedule notifications or actions to occur only on certain days, for example, to align with weekly reporting needs.

### Video-Guide

{% embed url="<https://www.loom.com/share/2f6ccd54c537488ead2a5402126d728f>" %}

## Setting Up Time Restrictions

### **Create a Rule**

* Begin by selecting the **product** for which you want to create a rule. This rule will apply to all devices within that product.
* Choose a **trigger** condition (e.g., when a new measurement is received).
* Set the rule’s conditions, such as “temperature is less than 10°C.”

**Select an Action**

* Choose an action type (e.g., **Email**, **Webhook**, **SMS**, or **Downlink**) to execute when the rule’s conditions are met.
* Customize the action details, such as the recipient for an email.

### **Configure Time Restrictions**

<figure><img src="/files/jVKEDUGNcDHjGzPFjjID" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/0SjlrdBZp4y2u3m4suzv" alt=""><figcaption></figcaption></figure>

* In **Advanced Settings**, enable **Time Restrictions**.
* Define the time frame for the action, specifying:
  * **Days of the Week**: Select specific days (e.g., Monday through Friday).
  * **Time Range**: Set the start and end times for each selected day.
* Example: Configure an email notification to send only from **12 a.m. to 8 a.m., Monday through Friday**. Notifications outside this period will not be sent.

### **Multiple Time Frames**

* For actions requiring more complex schedules, you can add multiple time restrictions. For example, create multiple time ranges within the same day.

### Using Multiple Actions with Individual Time Restrictions

The Time Restrictions feature allows you to configure different time frames for each action within a single rule:

* **Example**: Set an **Email** action to trigger only during a specified night shift (e.g., 12 a.m. to 8 a.m.) and a **Webhook** action to trigger at any time.
* This is ideal for workflows involving **shift-based alerts** or **targeted notifications** based on time-sensitive needs.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datacake.de/portal/rule-engine/new-rule-engine/time-restrictions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
