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, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, 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
180 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

Attribute updates with post-processing

When a device publishes client attributes to Edge, Edge forwards them to the server. The server runs a transformation script and pushes the result back to Edge as shared attributes. The device receives the update by subscribing to the shared attribute topic on Edge.

For an introduction to attribute types, see Attributes.

  • A ThingsBoard server (ThingsBoard Cloud or self-hosted) is running and reachable from Edge.
  • ThingsBoard Edge is installed and connected to the server.
  • A device is connected to Edge via MQTT, HTTP, or CoAP.

Step 1: Route device attributes to the server

Section titled “Step 1: Route device attributes to the server”

Configure the Edge rule chain to forward client attributes from the device to the server with the push to cloud node.

  1. On the server, go to Edge management > Templates, open the Rule chain tab, and open the rule chain template assigned to your Edge. On Edge 4.0 or later, you can instead go to Data processing > Rule chains on the Edge.

  2. Find the push to cloud node in the Search nodes field and drag it onto the rule chain sheet. In the Add rule node dialog, enter a name, select Client attributes in the Attributes scope field, and click Add.

  3. Connect the save attributes and save time series nodes to the push to cloud node with the Success label. Click Apply changes.

In the default Edge Root Rule Chain template, a Push to cloud node is already connected to these two nodes with the Success label. In that case, do not add a second node: open the existing one, set Attributes scope to Client attributes, and click Apply changes.

Step 2: Process and return attributes to Edge

Section titled “Step 2: Process and return attributes to Edge”

Configure the root rule chain of the server to transform the incoming attributes and push the result back to Edge as shared attributes. The script node sits between the save nodes and the push to edge node:

Use the following post-processing script in the script node. It works with both TBEL and JavaScript. Change the transformation logic as needed:

// Post-processing script, modify as needed
msg = {"attribute1_result": "value1_result"};
metadata = {};
return {msg: msg, metadata: metadata, msgType: msgType};
  1. On the server, go to Data processing > Rule chains and open the root rule chain.

  2. Find the script node in the Search nodes field (Transformation section) and drag it onto the sheet. Enter a name, paste the script above, and click Add.

  3. Find the push to edge node and drag it onto the sheet. Enter a name, select Shared attributes in the Attributes scope field, and click Add.

  4. Connect the save attributes and save time series nodes to the script node with the Success label. Connect the script node to the push to edge node with the Success label. Click Apply changes.

Step 3: Subscribe, then publish device attributes

Section titled “Step 3: Subscribe, then publish device attributes”

Subscribe to shared attribute updates before publishing. This way the device is listening when the server pushes the processed result back.

To get the device access token, go to Devices & assets > Devices on the Edge, open the device, and click Copy access token on the Details tab.

Use the protocol your device supports:

Subscribe to shared attribute updates:

Terminal window
mosquitto_sub -d -h $THINGSBOARD_HOST_NAME -t "v1/devices/me/attributes" -u "$ACCESS_TOKEN"
  • $THINGSBOARD_HOST_NAME is the hostname or IP address of your Edge.
  • $ACCESS_TOKEN is the access token copied above.

Publish client attributes:

Terminal window
mosquitto_pub -d -h $THINGSBOARD_HOST_NAME -t "v1/devices/me/attributes" -u "$ACCESS_TOKEN" -m '{"attribute1": "value1", "attribute2": true}'

After the device publishes, confirm that the attributes arrive at each point.

  • On the device. The subscribed client receives the processed shared attributes, for example {"attribute1_result":"value1_result"}.
  • On Edge. Go to Devices & assets > Devices, open the device, select the Attributes tab, and choose Client attributes in the scope dropdown. The published attributes, attribute1 and attribute2, appear in the list.
  • In the Edge rule chain. Open the push to cloud node and select the Events tab (Event type is Debug). With debug mode enabled, you see an IN record (attributes received from the device) and an OUT record (attributes pushed to the server), both with the message type POST_ATTRIBUTES_REQUEST.
  • In the server rule chain. Open the push to edge node and select the Events tab. You see an IN record (attributes received from Edge) and an OUT record (processed attributes pushed back to Edge).