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

Numbers, text and true/false values

How each kind of value is stored, what charts and aggregates can read, and how to store states and events so their history stays usable.

A telemetry value can be a number, true/false, text or a JSON object or array. All four are stored, but they are not equally useful later: only numbers have a chartable history and summaries. Decide the type of each key before your devices go live.

What each type gives you

TypeExampleLatest valueRaw history (up to the raw window)Minute, hour and day summariesCharts over long windows
Number21.5YesYesYes (sum, count, min, max, last)Yes
true / falsetrueYes, shown as On / OffStoredNoNo
Text"running"YesStoredNoNo
JSON{"x": 1, "y": 2}YesStoredNoNo

Numbers written as text ("21.5") are stored as text, not as numbers. Send numbers as JSON numbers.

Why non-numbers do not chart

  • Summaries are numeric. The minute job adds up, counts and compares numbers. Text, booleans and JSON values have no minute, hour or day summary.
  • Long windows read summaries. A chart or API read over more than 24 hours reads the summaries, so a text or boolean key has no points there.
  • Short windows read raw rows, but the device’s Telemetry tab and line charts draw numeric points only; a non-numeric point is not drawn.

So a text or boolean key shows well on a value card (latest value) but leaves a gap in a trend, and an increase, average or count over it is empty.

Store states as numbers

When you want the history of a state, send (or derive) a number:

Instead ofSend
"door": true / false"door_open": 1 / 0
"state": "running" / "stopped" / "fault""state_code": 1 / 0 / 2, and keep "state": "running" for display if you like
"zone": "Hall B""zone_id": 12
"event": "sos""event_code": 3

With 0/1 values:

  • the average over an hour is the share of the samples that were 1 (for example the share of samples with the pump running; a device that reports at a steady interval makes this the share of the time);
  • the max over a day tells whether it happened at all;
  • the sum of a 1-per-event key counts events.

Name the codes in the device profile’s Label and in your dashboard’s value mappings so people see words, not numbers.

Converting in a flow

If you cannot change the device, convert in the root flow before Save telemetry. For example, to add door_open from a boolean door:

  1. After the Message type switch, on the telemetry branch, add a Change block.
  2. Add a step: set msg.payload.door_open to the expression msg.payload.door ? 1 : 0.
  3. Keep the original door key, or add a second step delete msg.payload.door to store only the number.

For text states, use a Switch on msg.payload.state with one rule per state, each followed by a Change that sets msg.payload.state_code, then join the branches into Save telemetry. See Derived values.

Booleans in the profile

Set the key’s Type to Yes / no in the device profile. Dashboards then show the value as a flag (on value cards, switches and status lamps). This changes how the latest value is shown, not how the history is stored.

Text limits

  • Text: up to 1,024 characters. Longer text drops the key (string_too_long).
  • JSON: up to 4 KiB when written as JSON (value_too_large above it).
  • A JSON value is stored whole. If you need one of its fields as a trend, store that field as its own numeric key, for example with a Change block that sets msg.payload.pos_x to msg.payload.position.x.

Positions

A map card reads latitude and longitude from numeric keys (for example lat and lng). Send them as numbers. A position inside a JSON object cannot be charted or used for route replay.

Troubleshooting

SymptomCause and fix
A value card shows a value, the chart says No values in this windowThe key is text or boolean. Store a numeric copy.
A key shows as Text on the Telemetry tab though it holds numbersThe device sends numbers as text ("21.5"). They have no summaries and cannot be ticked for the trend. Send JSON numbers, or convert with number(msg.payload.key) in a flow.
A count or average of events is always emptyThe event is text. Store a 1 per event (or an event code) as a number.

See also A dashboard shows no data.