Skip to content
Stand with Ukraine flag

Too many devices with low battery level per site

  • Alarm Rule
  • 0 installs
  • v1.0.0
  • Jul 30, 2026
  • MIT license
  • v4.3+

Raises a Critical alarm on a site when the percentage of its devices reporting a low battery level exceeds a configurable threshold for a sustained period, and clears automatically once it drops back down.

Type
  • Alarm
Category
  • Equipment Health
  • Energy
Use Cases
  • Industrial Automation
  • Smart Building
  • Predictive Maintenance

Who it’s for

Facility and fleet managers and maintenance teams responsible for a whole site’s device population, asking “which sites need a battery run this week?” and “is this site’s battery fleet degrading?” — one or two low-battery devices are routine, but a large share of a site running low is a maintenance trip worth planning. It’s a site-level planning signal, most useful where a site has enough devices for a percentage to be meaningful (on a three-device site, one low battery is already a third).

What it does

Reads two time-series keys on the target entity — lowBatteryDevicesCount and totalDevicesCount — and raises a Critical alarm when their ratio rises above a configurable threshold for a sustained period. The alarm clears automatically once the ratio recovers for a sustained period.

low-battery-devices-percentage-diagram

How to set up

This rule reads lowBatteryDevicesCount and totalDevicesCount. Pair it with the upstream field that counts a site’s devices:

Active Device Count Per Site Dmytro Shvaika

Install this rule on the same “Site” (or similar aggregating) asset that field is installed on, or on its asset profile so every site of that type is covered, including ones added later. Every threshold/duration argument has a default value, so no per-entity setup is required before the rule starts evaluating.

How to customize

  • To change the low-battery threshold (default 50%) — set threshold as a server-scope attribute on the entity, or change the Default value on the threshold argument.
  • To change how long the condition must persist before alarming (default 30 minutes) — set alarmMinutes as a server-scope attribute, or change its Default value.
  • To change how long the recovery must persist before auto-clearing (default 10 minutes) — set clearMinutes as a server-scope attribute, or change its Default value.
  • To read the device counts from different telemetry keys — change the Time series key on the lowBatteryDevicesCount/ totalDevicesCount arguments.
  • 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.