Automatically translate this page?

How to get the last state of a registered device?

Getting device telemetry via REST API and in the flespi panel.

In some tasks, you don’t need to continuously receive messages from your device. But just get its state and last value of all parameters to answer the questions like:

  1. What was the last position of my device?

  2. When was the device online last time?

  3. What was the last value of the given sensor and when was it updated?

Telemetry is a structure that analyses each new message received by the registered device and stores the last value of each parameter and time when it was received. Following is the principle of device telemetry operation.

device telemetry scheme in flespi device

You can get telemetry via the appropriate REST API call. Telemetry will be returned as an object where the key is a parameter name, value is an object with fields value, and ts is a timestamp when the value was updated, e.g. 

     "telemetry": {
        "channel_id": {
          "ts": 1540982367,
          "value": 3300
        "chat_id": {
          "ts": 1540982367,
          "value": 168488620

It is a good practice to obtain telemetry over MQTT API:

  • Subscribe to topic flespi/state/gw/devices/{device-id}/telemetry/+
  • Receive current Telemetry as a retain message.
  • Receive updated value for every parameter each time it changes. ( With MQTT 5.0 the timestamp of parameter being updated is transmitted in MQTT message user properties.)

Telemetry can be viewed in TrackIt:

trackit telemetry

or the Telemetry device tab:

telemetry device tab

With telemetry feature, you don’t need to recall the latest messages to get device’s last state.

Please note that device telemetry values are stored for 370 days. It means that if the device does not update some parameters in 370 days, these parameters will disappear from telemetry automatically.

Also, check telemetry article on our blog.

See also
Obtain telematics data from Navtelecom devices via API in 5 easy steps.
Configuring the telemetry data forwarding from flespi to the Ruhavik tracking system.