New features on data buckets

Picture of Alvaro Luis Bustamante
Alvaro Luis Bustamante

Some days ago, we released some new features on data buckets that we wanted to share with you! Here they come:

Show tabular data in the bucket explorer

Now the data bucket explorer allow displaying your data bucket in a tabular format, so you can review the information in a more comprehensive way than the raw JSON value. Did you know that you can store more than one value per entry into a data bucket? Just create a resource with more than one output value!

Clear total or partial data buckets

Sometimes it can be useful to clear the bucket information without deleting the whole bucket, creating and configuring it again. Therefore, now you can clear the bucket, or a part of them easily from the bucket page. In the clear process, the bucket can still recording information from your device.

Data Bucket write function

Finally, we think that this latest feature is a great addition to support battery powered devices recording to a data bucket. So we have introduced a new function in Arduino/Server to support writing to the bucket as required. For example, suppose that you have a NodeMCU, Wemos, or an ESP8266 for recording temperature and humidity periodically. You will need a resource defining your device output, that just provide the temperature and humidity from your sensor (a DHT in this case). Once defined, in the loop we can just handle the connection, so the device connects to the network and authenticates into the platform, then write to the bucket the information from our resource, and finally, let the device sleep so it does not consume almost battery while idle.

[cpp]
void setup() {
// define the resource with temperature and humidity
thing["TempHum"] >> [](pson& out){
out["temperature"] = dht.readTemperature();
out["humidity"] = dht.readHumidity();
};
}

void loop() {
// handle connection
thing.handle();
// write to bucket BucketId
thing.write_bucket("BucketId", "TempHum");
// sleep the device SLEEP_MS milliseconds
ESP.deepSleep(SLEEP_MS*1000, WAKE_RF_DEFAULT);
}
[/cpp]

We can also write to a data bucket from a pson value directly, without defining a resource, just write the following:

[cpp]
void loop() {
// handle connection
thing.handle();
pson data;
data["temperature"] = dht.readTemperature();
data["humidity"] = dht.readHumidity();
thing.write_bucket("BucketId", data);
ESP.deepSleep(SLEEP_MS*1000, WAKE_RF_DEFAULT);
}
[/cpp]

Note: For using the write_bucket call over a bucket, it is necessary to set the bucket source to “From Write Call”.

Do you have any doubts? Contact us!

Discover how Thinger can help your business with our All-in-One platform. 

Start building your IoT products

With the All-in-One Best Leading IoT Platform