New: the AI firewall watches every module and explains each incident in plain words. See how it works

Cleaning up decoded values

Rename and convert codec output keys so that sensors from different makers report the same names, units and types.

Library codecs name their output keys the way each device maker does. One maker’s temperature is temperature, another’s is temperature_red; one parking sensor reports "occupied" as text, another 1. If you mix makers, your dashboards and alarm rules get easier when every device reports the same keys in the same form. This page shows two ways to get there: change the values in a flow, or change the codec.

Option 1: clean up in a flow

Every device message passes through a root flow before it is stored: your organisation’s root flow, or the profile’s own root flow when the profile has one. Add the clean-up steps there, before the Save telemetry block. Then the cleaned values are what is stored.

Good for: renaming keys, converting units, turning text into numbers, dropping keys you do not want, without touching the codec.

Best practice: give each sensor type its own LoRaWAN profile with its own root flow, so each flow only handles one payload shape.

Rename a key

Use the Change block with a move step, or a set step followed by a delete step:

StepPathValue
setmsg.payload.temperaturemsg.payload.temperature_red
deletemsg.payload.temperature_red

Convert a value

Use the Calculate block. Examples:

NeedExpressionTarget
mV to Vround(msg.payload.battery / 1000, 2)msg.payload.battery_v
°F to °Cround((msg.payload.temp_f - 32) * 5 / 9, 1)msg.payload.temperature
Text state to numbermsg.payload.parking_status == "occupied" ? 1 : 0msg.payload.occupied
Numeric text to a numbernumber(msg.payload.level)msg.payload.level

Arithmetic on text fails, even on numeric text such as "21.5": convert first with number(...).

Drop keys you do not need

Use a Change block with delete steps, or delete keys with a pattern (for example debug_.*). The Save telemetry block can also be limited to the keys you list.

Keep the radio keys

The lora.* keys (lora.rssi, lora.snr and others) arrive in the same msg.payload. Leave them in if you want reception history.

Where values arrive in the flow

The Device message trigger sends telemetry as one message per record, with a flat msg.payload of { key: value }. Nested codec output is already flattened with dots, so a value probe.temperature is the key "probe.temperature". Read the key with its full name.

For the blocks in detail, see Data transform blocks and Hosts, the root flow and profile root flows.

Option 2: change the codec

Save a copy of the library codec and edit it. See Write your own codec.

Good for: getting the right key names and units at the source, so every flow, dashboard and export sees them.

ChangeHow in the table
Rename a keyChange the field’s field name.
Scale a valueSet scale (and digits for the decimals).
Change the unit labelSet unit.
Text instead of a codeUse enum to map numbers to words, or remove it to keep the number.

Remember the revision rule: once your codec is published, a new revision cannot remove or rename keys. Decide the names before you publish, or publish under a new id.

Which option to choose

SituationChoose
A few keys to rename or convertFlow
Many sensors of one model, and you want clean keys everywhereCodec copy
Combining values (for example, dew point from temperature and humidity)Flow
The library codec decodes a frame wronglyCodec copy

Text, numbers and true/false

Keep each key one type over time: a key that is sometimes a number and sometimes text is hard to chart and compare. Turn states that you want to chart or compare (open/closed, occupied/free) into numbers or true/false in the flow. See Numbers, text and true/false values.

Check the result

  1. Open a device’s Telemetry tab, or the flow’s debug output, after the next uplink.
  2. Check the key names and values.
  3. Update dashboards and alarm rules to the new key names.