Skip to content

Platform

Buckets

Store the data of every device of a product in Data Buckets defined once in the product profile, shared or one per device.

Feature4 min read

The Buckets card of a product profile stores the data of every device of the product without creating a Data Bucket per device by hand. Each entry takes its data from a source, such as a device resource read every minute, and writes it to a bucket that the platform creates on the first write.

When to use it ​

  • To keep the history of a fleet: telemetry read at an interval, or every message on a topic.
  • To let users and project members read the data of their own devices without access to the whole bucket.
  • To feed dashboards with the From Device Bucket source, which shows the data of the device being viewed.

One bucket or one per device ​

The bucket ID decides how the data is split:

Bucket IDResult
A fixed ID, such as meter_telemetryOne bucket for the whole product. Each record is tagged with its device (and its group), so you can read the data of one device.
An ID with {{device}}, such as {{device}}_readings or {{product}}_{{device}}One bucket per device. Its records do not get the device and group tags.
An ID with other fields of the event, such as {{asset_group}}_telemetryOne bucket per value, for example one per customer when each customer has its own asset group. Records keep the device and group tags.

The ID can use any field of the event that carries the data: {{device}}, {{user}}, {{product}}, {{asset_type}} and {{asset_group}} (see Payloads).

Bucket entry of the product profiledevice resource at an interval, stream or MQTT topic · optional Payload ProcessingA · Fixed bucket IDBucket ID meter_telemetrymeter_01meter_02meter_03meter_telemetryone bucket for the productdevicegroupvalmeter_01north{…}meter_02north{…}meter_03south{…}A device reads only its own records(Device Bucket, filtered by the device tag)B · Bucket ID with {{device}}Bucket ID {{device}}_readingsmeter_01meter_02meter_03meter_01_readingsmeter_02_readingsmeter_03_readingsOne bucket per device, created on its first writerecords without the device and group tags
One bucket or one per device

Tags and fields from the topic ​

With a Device Topic source, {{device}} or the wildcard + in the topic receive the messages of every device: my_product/{{device}}/temperature or my_product/+/temperature. Each {{name}} of the topic, such as {{line}} in plant/{{line}}/{{device}}, becomes a tag of the record.

{{field=a|b}} is different: it matches one of the listed levels and stores each one as a field of the same record. With the topic plant/{{device}}/{{field=temperature|humidity}}, a device that publishes 21.5 on plant/sensor_01/temperature and 40 on plant/sensor_01/humidity writes one record with both values. Messages with the same tags that arrive within one second go to the same record.

Device Topicplant/{{device}}/{{field=temperature|humidity}}MQTT MESSAGESTOPIC LEVELSBUCKET RECORDMessage 1plant/sensor_01/temperaturepayload21.5Message 2plant/sensor_01/humiditypayload40plant{{device}}{{field=temperature|humidity}}temperaturehumiditylevel 1 · fixedlevel 2 · tagfieldfieldts1790842200000TAGdevicesensor_01FIELDStemperature21.5humidity40Messages with the same tags that arrive within one second are merged into one record.
Tags and fields from the topic

Payload Processing receives the merged fields. With the topic shellies/{{device}}/relay/0/{{field=energy|power}}, the function gets:

json
{"energy": 1386640, "power": 6.55}

Add a bucket to the profile ​

YOUR_SERVER is iot.thinger.io on the free Cloud account, or the domain of your private instance. YOUR_PRODUCT is the product ID.

Console

  1. Open the Buckets card

    Open the product on its Profile tab and click Add in the Buckets card.

  2. Set the source

    Set the Bucket Identifier. On Bucket Source, choose the source, such as Device Resource with the Resource Name and a Sampling Interval, and the Payload.

    Bucket modal of the env_sensor product with a Device Resource source, the climate resource, sampled every 60 seconds
    Product bucket fed by a device resource
  3. Set the bucket options

    On Settings, set the Bucket Name, the Bucket Description, the Data Tags (record fields stored as tags, besides device and group) and the Backend. Leave Enabled on and click Save.

API

PUT/v1/users/{user}/products/{product}/profile/{category}/{resource}API reference
bash
curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/buckets/meter_telemetry" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Telemetry",
    "enabled": true,
    "data": {
      "source": "resource",
      "resource": "telemetry",
      "update": "interval",
      "interval": 60,
      "magnitude": "second",
      "payload_type": "source_payload"
    },
    "retention": { "period": 6, "unit": "months" }
  }'

backend and retention apply when the bucket is created. A bucket ID with {{device}} cannot go in the path: send it in the body of PUT .../profile/buckets, which replaces every entry.

CLI

The CLI cannot edit profile entries. Include them in the profile.buckets of the document you pass to thinger product create YOUR_PRODUCT --from product.json, and read the data with thinger bucket read meter_telemetry.

AI

Ask your AI agent

Add a bucket to the product YOUR_PRODUCT that stores the telemetry resource of each device every minute, and keeps six months of data.

The agent uses thinger_resource_create with the product_profile_bucket type. See MCP tools.

Read the data of one device ​

The Buckets entry of a device of the product lists its product buckets and shows only its own data. From the API, GET /v3/users/{user}/devices/{device}/buckets lists them and GET /v3/users/{user}/devices/{device}/buckets/{bucket}/data reads the data, with the same parameters as a Data Bucket (see the REST API reference); agents use thinger_bucket_data_read with device. Users with access to the device read its data without access to the whole bucket.

Limits ​

  • The bucket is created on the first write, outside any project. Add it to a project yourself if its members need the whole bucket.
  • Do not create the bucket by hand. The product creates it with the tags it needs (device, group, the Data Tags and the topic tags); a bucket you create with the same ID receives the data without those tags, so filtering its data by device does not work (for example, Limit Bucket Data in a project). If you remove the bucket, the next write creates it again.
  • The tags, the backend and the retention apply only when the bucket is created. After changing the Data Tags or the placeholders of the topic, remove the bucket so the product creates it again with the new tags.
  • Removing the entry stops new writes; the bucket and its data stay.