Skip to content
Stand with Ukraine flag

Tank Level High / Low Alarm

  • Alarm Rule
  • 1 install
  • v1.0.2
  • Aug 7, 2026
  • MIT license
  • v4.3+

Alert when a tank runs low and needs a refill, or climbs too high and risks overflow. Built for fuel tanks, water tanks, silos, and chemical storage.

Type
  • Alarm
Category
  • Threshold
Use Cases
  • Tank Level Monitoring
  • Industrial Automation
  • Smart Farming

Who it’s for

Tank-farm and fuel-depot operators, water and wastewater utilities, and farm or industrial storage managers. Use it when a tank’s fill level should stay inside a working range and both edges matter: “is this fuel or water tank about to run dry?”, “is a silo or chemical tank close to overflowing?”, “which sites need a refill run this week?”

What it does

Reads the device’s fillPercentage telemetry and raises a Major alarm when the tank drops below the low threshold or climbs above the high threshold, so one alarm covers both running dry and overflowing. It waits for the level to stay past a threshold for a short hold before firing, so waves, foam, or fill turbulence do not cause a false alarm, and it clears once the level comes back to the safe range in the middle and settles there. The alarm message carries the live fill level next to both thresholds, so the alarm list shows which edge was crossed and by how much.

Tank Level High / Low Alarm diagram

How to set up

The rule has default values for every threshold, so it works as soon as it is installed. Install on a device or asset profile so the alarm covers every tank of that type at once and automatically picks up any new tank added later. Single-device or single-asset installs are also supported.

The rule reads a fill percentage. If your sensor reports a raw level, depth, or distance instead, convert it to a 0-100 percentage in a calculated field first and point the metric argument at that output key:

Tank Fill Percentage from Depth Sensor Dmytro Shvaika

How to customize

  • To monitor a different telemetry - change the Time series key on the metric argument (e.g. fillPercentagelevel or ullage to match your sensor’s key).
  • To use different threshold attribute names - change the Attribute key on the threshold arguments to match what your tanks already use (e.g. lowLevelThresholdminFill).
  • To change the low and high thresholds used when no per-entity attribute is set - change the Default value on the lowThreshold and highThreshold arguments.
  • To change where the alarm clears - change the Default value on the lowClear and highClear arguments. The level has to return between them and stay there for the clear hold before the alarm clears, and the gap to the trigger thresholds is what stops flapping.
  • To debounce sensor noise on the way in - change the Default value on the holdMinutes argument. The level has to stay past a threshold for that many minutes before the alarm fires, which filters transient waves, foam, and fill turbulence. To remove the hold entirely, switch the Trigger condition type to Simple.
  • To change how long the level must settle before the alarm clears - change the Default value on the clearHoldMinutes argument. The level has to stay inside the clear range for that many minutes, which filters the same waves, foam, and fill turbulence on the way out that holdMinutes filters on the way in. To clear on the first reading back inside the range instead, switch the Clear condition type to Simple.
  • To tune thresholds at runtime without editing the rule - set the value on the entity as a regular server-side attribute. It can be edited directly from a dashboard using the Update Multiple Attributes input widget:
    • Per device or asset - set the attribute (e.g. lowLevelThreshold, highLevelThreshold) on the tank itself. The per-entity value overrides the Default value.
    • Per customer (in deployments that use customers) - change Entity type on the relevant argument to Current owner, then set the attribute on the customer. Every tank that customer owns picks up that value.
    • Tenant-wide - change Entity type to Current tenant, then set the attribute on the tenant. The value applies across every tank.
  • To alarm on only one edge - open the Trigger condition and delete the comparison you do not need: keep fillPercentage < lowThreshold to watch low level alone, or fillPercentage > highThreshold to watch overflow alone. Then drop the matching half of the Clear condition as well, so the alarm clears anywhere on the safe side.
  • To raise the severity - the rule ships as Major. Change the create rule to Critical if a tank leaving its safe range should reach an on-call rota rather than a daily review.
  • To split refill and overflow into separate alarms - build a second alarm rule, one edge in each, each with its own clear condition and its own alarm type. One rule has a single clear condition shared by every severity it can raise, so two opposite-edge severities inside one rule would each hold the other’s alarm open when the level settles between a threshold and its clear value.
  • To make the alarm manual-clear-only - remove the Clear condition. The alarm then stays active until an operator clears it.
  • To control where the alarm shows up - toggle the propagation flags under Advanced settings.

Share Your Alarm Rule with the Community

Built a reliable alarm rule? Export it as a JSON from ThingsBoard and publish it to the IoT Hub. Share it with thousands of ThingsBoard developers and help the community react to incidents faster.