Jul 17, 2024

Handling historical data with stateful payload decoders

Alexis Leibbrandt

One characteristic of IoT devices under the LPWAN umbrella is their ability to exchange small packets of data over wide distances (up to several kilometers). A low-bandwidth exchange at a fixed interval effectively reduces the amount of power used by these devices and allows them to support a variety of IoT cases.

The main drawback of the limited message size of some protocols (e.g. 50 bytes/message in the LoRaWAN standard) is that some devices need to split their payload into multiple messages. This poses challenges in accurately interpreting and reconstructing the data from these fragmented payloads.

We’re bringing a solution to this.

A diagram showing how telemtry/data is sent

Introducing stateful Device Types

Traditionally, our platform utilized stateless Device Types, meaning each incoming message was processed independently, with access only to its immediate payload. With stateful Device Types, the platform not only processes the current payload but also has access to a state containing information from historical runs.

In the case of a device splitting its payload into several messages, this enables the aggregation of the fragmented messages and the reconstruction of the original, complete payload. See the code below for an example of this.

A photo of code

This also opens the door to Device Types performing calculations on historical data. 

Historical data calculations within the Device Type

The Rule Engine of akenza allows you to nest rules together and process data the way you want it, including operations on historical data. Stateful Device Types take this to the next level by allowing calculations on historical data within the Device Type.

See how this can be useful in the following situations.

Washroom usage

Utilizing a simple door sensor that reports its cumulative count with each transmission, a stateful Device Type can deduce washroom usage by calculating the increment in door activations between messages. See the example below based on the readings of a reed sensor.

A photo of code

Environmental monitoring

Stateful Device Types can also be used to track changes in data patterns. This can be helpful in identifying anomalies in temperature and humidity readings, for example, deriving trends and triggering alerts if needed.


To start using stateful decoders in your custom Device Types, refer to our documentation: Stateful Operations.

Need help with your IoT project?

To learn more about how akenza can help you build smart solutions with ease, contact us or directly sign up for a free trial today.

Changelog

If you want to follow the latest updates and upcoming features of akenza in real-time, be sure to check our changelog.