Skip to content
Stand with Ukraine flag

QR Code

  • Widget
  • v1.0.0
  • Sep 1, 2026
  • MIT license
  • v4.2+ | Built-in
QR Code

Displays the QR code. The code is calculated using a configured pattern or function based on the values of the selected entity attributes or the latest telemetry data.

Widget Type
  • Latest
Category
  • Cards & Info

Who it’s for

Teams that need to get from a screen to a thing — a technician scanning a dashboard to open the right work order, a warehouse operator pairing a handheld with the asset in front of them, an installer printing labels that carry a device’s own identifier. The code is built from the entity’s data, so it is correct for whichever entity the dashboard is showing.

What it does

The QR Code widget renders a QR code whose content is assembled from the selected entity’s attributes and latest telemetry. The default pattern, ${entityName}, encodes the entity’s name; a pattern like https://example.com/asset/${serialNumber} encodes a link that resolves to the specific device the dashboard is currently displaying.

  • The code follows the dashboard — because the content is built from entity data, changing the selected entity regenerates the code without any reconfiguration.
  • Patterns mix text and values freely, so a URL, a serial number or a structured payload are all a matter of writing the string.
  • A text function replaces the pattern when the content has to be computed or chosen conditionally, receiving the data and returning the string to encode.
  • Any attribute or telemetry key is available, so the code can carry an identifier the entity’s name does not contain.
  • The QR Code widget encodes text: it does not scan codes, and it renders nothing until its pattern resolves to a non-empty string.

How to set up

Data keys

The QR Code widget takes any number of data keys, addressed by name in the pattern.

KeyRoleTypeDescription
AnyA value encoded into the codeTimeseriesWritten as ${key name} in the pattern. Attributes work equally well and are the usual choice, since identifiers rarely change. ${entityName} is available without declaring a key.

The pattern resolves against the first entity found in the entity alias, so point the alias at a single entity — or at one selected by the dashboard’s state — rather than at a group. A pattern is required; leaving it empty renders no code.

Content

SettingDefaultEffect
Use QR code text functionOffSwitches from a fixed pattern to a function that returns the encoded text
QR code text pattern${entityName}The string encoded, with ${...} placeholders resolved live
QR code text functionReturns the first entity’s nameUsed instead of the pattern when the toggle is on

How to customize

  • To encode a link instead of a name — write the full URL into QR code text pattern with the identifying value as a placeholder.
  • To use a device identifier — add that attribute as a data key and reference it by name in the pattern.
  • To build the content conditionally — turn on Use QR code text function and return the string from the function.

Tips

  • Encode an attribute such as a serial number rather than the entity name. Names get edited for readability, and every printed label carrying the old name stops resolving the moment someone tidies the entity list.
  • Test the code with the scanner the audience will actually use before printing anything. A pattern that produces a valid string but the wrong URL scheme fails in a way that looks like a damaged label rather than a configuration mistake.

Share Your Widget with the Community

Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.