Skip to content
Stand with Ukraine flag

Auto-Group IoT Devices by Type

  • Rule Chain
  • 40 installs
  • v1.0.0
  • Jun 15, 2026
  • MIT license
  • v4.2+
  • PE

Add IoT devices to entity groups matching their device profile, with on-demand group creation for large fleets, RBAC scoping, and firmware-version segmentation.

Type
  • Core
Category
  • Automation
Use Cases
  • Asset Tracking
  • Fleet Tracking
  • Predictive Maintenance
  • Industrial Automation
  • Smart Farming
  • Save Timeseries
  • Save Attributes
  • Log RPC from Device
  • RPC Call Request
  • Add to Group by Type

Who it’s for

Platform administrators and fleet operators onboarding many IoT devices who want them auto-organized into entity groups by their device profile without manually picking a group every time a device is created. Built for large fleets where per-device group assignment doesn’t scale — firmware-version segmentation, scoped access via groups, audit/reporting by device type.

What it does

Listens for device lifecycle events (Entity Created, Entity Updated) and places each device into the entity group whose name matches the device’s profile. Groups are created on demand the first time a profile is encountered.

Scenario 1 — New device, new profile. A new device is registered with profile Compressor. No Compressor group exists yet — the chain creates it on demand and adds the device.

New device, new profile

Scenario 2 — New device, existing profile. A new device is registered with profile Pump. The Pump group already exists; the chain just adds the device to it (no group creation needed).

New device, existing profile

Scenario 3 — Profile change. A device’s profile is changed from Compressor to Pump. The chain removes the device from the Compressor group and adds it to the Pump group — atomic move, no orphan membership.

Profile change

The rare case is profile change. Profiles are usually sticky — most operators set a device’s profile at provisioning and leave it there. When that happens, the chain atomically moves the device from the old type’s group to the new one, so the group graph never falls out of sync with reality.

The chain extends the default ThingsBoard PE root chain with the auto-grouping flow — two filters that scope the path to device events with a deviceProfileId, plus the action node that adds the device to a group named after its profile:

  • An entity type filter — labelled Originator is Device? in this chain. Scopes the flow to device originators. The same lifecycle events fire for assets, customers, dashboards, and other entity types; this filter drops them.
  • A check fields presence filter — labelled filter only devices in this chain. Passes only messages whose body carries deviceProfileId. Skips alarm-on-device events that come from a device originator but carry alarm JSON instead of the device payload.
  • An add to group action node — labelled Add to Group by Type in this chain. Adds the device to the entity group whose name matches its profile — the $[type] templatization pattern reads msg.type on Entity Created/Updated messages. Creates the group on demand and removes the device from any other type-named group it currently belongs to — that combination turns a profile change into a single atomic move.

How to set up

  1. Click Install to open the install dialog. The dialog offers two paths:

    • Bind to a profile — enable Set as profile default rule chain and pick the target device profile. The imported chain becomes that profile’s default rule chain.
    • Install only — leave the toggle off. After install, either set it as the root — it already bundles the default routing plus the auto-grouping flow — or extract the auto-grouping flow into a nested rule chain and connect it to your Message Type Switch with both the Entity Created and Entity Updated labels.
  2. The chain runs on device lifecycle events — create a new device or switch a device’s profile to trigger it.

How to customize

  • To require a pre-existing group — disable Create new group if not exists on the Add to Group by Type node if you’d rather have devices whose profile name doesn’t match an existing group route to Failure instead of auto-provisioning a group.

Share Your Rule Chain with the Community

Built a useful automation workflow? From a simple alarm recipe to a complex multi-cloud integration — publish it to the IoT Hub. Share it with thousands of ThingsBoard developers.