Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read and how they find the site, so we can improve it (Google Analytics).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Create and Clear Alarms

Monitor a temperature sensor and automatically create and clear alarms when readings go outside an acceptable range. This recipe uses importable alarm rule configurations so you can examine the logic and adapt it for your own scenario.

Assume your refrigeration equipment has a temperature sensor that periodically publishes telemetry to ThingsBoard. The normal operating range is 2 °C – 5 °C. Outside this range, the condition is treated as abnormal:

  • Create an alarm when temperature drops below 2 °C or rises above 5 °C.
  • Clear the alarm automatically when temperature returns to the normal range.

This pattern applies to cold storage, food logistics, and industrial refrigeration monitoring.

Review the Alarm rules documentation before proceeding — it covers alarm creation, trigger conditions, and the alarm lifecycle.

You also need a device to test with. Use an existing device or create a new one:

  1. Navigate to Entities ⇾ Devices.
  2. Click + Add device ⇾ Add new device.
  3. Set Device name to Thermometer and Device profile to thermostat.
  4. Click Add.

Two alarm rules cover the two failure conditions:

Rule Alarm type Severity Create when Clear when
High temperature High temperature Critical temperature > 5 temperature ≤ 5
Low temperature Low temperature Warning temperature < 2 temperature ≥ 2

Each rule is evaluated on every incoming telemetry message: the value is read, compared against the create and clear conditions, and the alarm is created, updated, or cleared accordingly.

Step 1. Import the High Temperature Alarm Rule

Section titled “Step 1. Import the High Temperature Alarm Rule”
  1. Download the alarm rule configuration file: high_temperature_alarm_rule.json
  2. Go to Alarms ⇾ Alarm rules.
  3. Click + Add alarm rule ⇾ Import alarm rule.
  4. Upload the downloaded file.
  5. Specify your device or device profile as the target entity.
  6. Click Add.

Step 2. Import the Low Temperature Alarm Rule

Section titled “Step 2. Import the Low Temperature Alarm Rule”
  1. Download the alarm rule configuration file: low_temperature_alarm_rule.json
  2. In Alarms ⇾ Alarm rules, click + Add alarm rule ⇾ Import alarm rule.
  3. Upload the downloaded file.
  4. Specify your device or device profile as the target entity.
  5. Click Add.

Publish test telemetry values using Check connectivity or the curl commands below.

Trigger the High temperature alarm — publish a value above 5 °C:

Terminal window
curl -v -X POST \
--header "Content-Type: application/json" \
--data '{"temperature": 7}' \
http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry

Clear the High temperature alarm — publish a value in the normal range:

Terminal window
curl -v -X POST \
--header "Content-Type: application/json" \
--data '{"temperature": 4}' \
http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry

Trigger the Low temperature alarm — publish a value below 2 °C:

Terminal window
curl -v -X POST \
--header "Content-Type: application/json" \
--data '{"temperature": 1}' \
http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry

Clear the Low temperature alarm — publish a value in the normal range:

Terminal window
curl -v -X POST \
--header "Content-Type: application/json" \
--data '{"temperature": 4}' \
http://$THINGSBOARD_HOST_NAME/api/v1/$ACCESS_TOKEN/telemetry

After each step, check the alarm state on the Alarms page, on the device’s Alarms tab, or on a dashboard widget.