Datacake Docs
  • Welcome
  • Get Started
  • Changelog
  • Best practices
    • Best practices: Getting started
    • Best practices: Resolution (Timeframe)
    • Best practices: Dashboards
    • Best practices: Reports
    • Best practices: Grouping Devices
  • Datacake LNS
    • Getting Started
    • Gateways
      • Milesight LoRaWAN Gateway - UG6x
      • RAKwireless WisGate Edge Light 2
    • Devices
    • Add Devices without Gateway
  • Device
    • Product
    • Configuration
    • Claiming
    • Historical Data
    • Database
      • Configuration Fields
      • Fields
        • Manual input
        • Field Roles
        • Formulas
        • Mapping Fields
      • Data retention & Datapoints
      • Examples
        • Mapping 4-20mA Signals
        • Converting Units
  • Dashboards
    • Global Dashboards
      • Setting Homepage
    • Device Dashboards
    • Multi-Device Dashboards
    • Widgets
      • Value Widget
      • Chart Widget
      • Image Map
      • Map Widget
      • Text Widget
      • SOS Widget
      • Boolean Widget
      • iFrame Widget
      • Downlink Widget
      • Set Value Widget
      • Measurement List Widget
      • Heatmap Widget
      • Table Widget
      • Image Widget
  • Portal
    • Multi-Tenancy (Workspaces)
    • Reports
      • Energy Report
    • Administrators
    • Members
      • API Users
    • Security & Privacy
    • Billing
      • Support Packages
      • VAT Exemption / Tax ID
      • SMS Credits
      • Access Invoices
      • Unused time and Remaining time in Invoices (Prorations)
      • Codes
    • White Label
    • Rules
      • Legacy Rule Engine
        • Sending notifications via Telegram
      • New Rule Engine
        • Rule Engine Table Overview
        • Copy/Paste and Template Functionality
        • Advanced Rule Engine E-Mail and Webhook Templates
        • Time Restrictions
    • Zones
  • Cake Red
    • Get Started
    • Overview
  • LoRaWAN
    • Get Started
      • CSV Import
      • Custom LoRaWAN Device
    • Configuring LNS
      • The Things Stack (TTN / TTI) Automated Setup
      • The Things Stack (TTN / TTI) Manual Setup
      • Loriot
      • Kerlink Wanesy
      • Helium
      • ChirpStack
      • Tektelic
      • Actility ThingPark
      • Senet
      • Milesight Gateway
      • KPN
    • Downlinks (LoRaWAN)
      • Set Time Frame
    • Securing Webhooks
    • Payload Decoders
      • Location and GPS
      • Access Gateway Metadata
      • Access Measurements
      • Global Variables
    • Using Cayenne LPP
    • Converting Payload
  • Generic API Devices
    • HTTP Downlinks
  • Integrations
    • MQTT
    • Particle
      • Get Started
      • Adding Integrations
      • Decoding Payloads
      • Calling Functions
      • Templates
        • Particle Tracker One
    • Incoming Webhooks
    • Outgoing Webhooks
      • Securing Outgoing Webhooks in Datacake
    • Golioth
    • Blues Wireless Notecard
    • Sigfox
    • Swarm Asset Tracker
    • Grandcentrix Modbus Cloud Connect
    • YuDash LYNX IoT Gateway
    • Dragino NB-IoT
      • Changing NB-IoT Bands
    • Hardwario CHESTER
    • 1NCE OS
  • API
    • Exporting Data
    • Record Measurements via API
    • Node RED to Datacake
    • Generate Access Token
    • Internal MQTT
      • Get Started
      • MQTT Documentation
      • MQTT over WebSocket
      • Example Code
    • GraphQL API
      • Using GraphQL
      • Device Creation
      • Tutorials
        • Read Group via Tags
  • Guides
    • Python
    • Send Slack Notifications
    • Forward Data to Cake Red
    • Multiple Data Feeds
    • Automated Dynamic Downlinks
    • Ingesting JSON Data into Datacake API Devices
    • Working with Default HTTP Decoder on API Devices and Code Examples
    • Accessing Measurements in Decoders
    • Connecting Datacake to Notion Using Zapier
    • How to set up and use location on non-GPS devices
    • How to integrate with AWS IoT Core
    • How to Schedule Mass-Downlinks (Multicast) using Datacake Rule Engine
    • How to Map Sensor Values to Ranges or Booleans, Strings using Mapping Fields
    • Understanding Internal vs. External MQTT Brokers on Datacake
    • Sending UDP Messages between 1NCE OS and Datacake
    • Concepts of LoRaWAN Payload Decoders on Datacake
    • How to check if a value stays above or below limits for given time
Powered by GitBook
On this page
  • Introduction
  • Getting started
  • Choosing a time range
  • Using hysteresis
  • Actions
  • Email
  • SMS
  • Webhook
  • Send LoRa Downlink
  • Execute D Zero OS function
  • Limiting the execution
  • Retriggering
  • Rate limiting

Was this helpful?

  1. Portal
  2. Rules

Legacy Rule Engine

The Legacy Rule Engine allows you to create rules for specific devices.

Last updated 1 year ago

Was this helpful?

Introduction

Rules allow you to act on events caused by a device's measurements. They allow you to set different triggers and alarms, such as:

  • Send notification messages via email or sms

  • Call external services via webhooks

  • Send downlinks to LoRa devices

  • and much more

Getting started

Rules can be created and accessed from the workspace's sidebar menu. Rules that are related to a device (one or more conditions reference the device) are additionally shown in the device's Rules tab.

Create your first rule by clicking the "Add Rule" button in the top right.

Here you can set a name for the rule and add one or more conditions and actions. Choose a device and field from the first dropdown and then select the condition. In the following case, I want the rule to trigger when the value of the field Testfield on the API Test device falls below 20:

Choosing a time range

A rule can check the current value of a field or alternatively the sum or average over a specified timeframe. The timeframe can be chosen using natural language.

Using hysteresis

Setting a hysteresis allows you to handle values that jump around a threshold. Imagine a temperature sensor that isn't so accurate and outputs a series of values like 19.9ºC, 20.1ºC, 19.8ºC, 20.2ºC. Setting the condition to "larger than 20ºC" would cause the rule to trigger two times in the above series. Setting a hysteresis of 1ºC would require the value to drop below 20-1 = 19ºC before the rule can trigger again.

The following chart further visualises the function of a hysteresis:

Actions

Email

The email action allows you to send an email to one or more recipients. You can set the subject as well as a rich formatted message. Using "Insert Placeholder" you can also insert measurements from your devices.

SMS

Similar to the email action, the SMS action allows you to send text messages to one or more recipients. Please note that your workspace needs to have SMS credits which can be purchased in the workspace's billing section.

Webhook

External systems that support incoming webhooks can be notified by using the webhook action. You can set an URL, custom headers as well as a custom body that can contain placeholders.

Send LoRa Downlink

You can send predefined downlink messages to your LoRa devices using this action.

Execute D Zero OS function

If you own a Datacake Industrial Gateway, you can use this action to execute functions on the device.

Limiting the execution

Retriggering

By default, the rule is only triggered once after a condition becomes true. It is only triggered again once the condition becomes false and true again (see the hysteresis section above). You can change this by activating the "Allow retriggering" option.

Rate limiting

You can set a number of seconds that have to pass before the subsequent execution of a rule.

An empty rule
A simple condition
This condition evaluates the average of the field