Add last time the device reported data (lastStateUpdate) to node Get: Device


In some of the implementations in our applications we have to return the last time the device reported data (often this is done in a list), for that we use the Composite State included in node Get: Device, and search among the attributes for the last one.

However, we noticed that if several attributes are included in the composite state, the request takes longer to respond. And we also added some metrics that are predictions in our applications, which means we have states in the future (up to 24h).

So, to solve these two previous points, we had to include a specific attribute, which we considered when it was reported, as being the ‘lastStateUpdate’, but for that it is necessary to include this attribute in all devices that publish data in our applications.

Thus, an interesting feature would be the possibility to include this information by default (as well as the composite state), and it would return the last time a state was reported by a device (not necessarily the timestamp of the reported data, but the time that the device sent the data to the platform).

Happy to answer any questions!


Hey @Vander_Maziero,

This request does make sense, and the workaround you have taken is one that I would have suggested.

Is there something that the Gauge Query Node does not do that has prevented you from using it?

I’ll get this feature request in for you and let keep you up to date on its development.

Thank you,

Hey @Heath,

Thank you for the quick answer.

The use of Gauge Query Node was an option evaluated, but when using the advanced query all devices would be grouped, returning only one value for all, which would make its use impossible, unlike the scenario we have, where we need the last publication of each device. It would even be possible to use it, but we would have to make a request for each device, which costs performance, for a list of devices. In addition, there would still have to be a common attribute between all devices, so that no additional configuration is needed.

Our need would be something like the API Get: State that returns the last state of a device, but it does not allow advanced query (it is necessary to search for each device individually), apart from the fact that it would return the time of the last state that does not necessarily reflect the time that it was published.

It would be something like having an input based on the advanced device query and returning a list of devices as

      "id" : "device1",
      "lastCommunication": "2021-07-05T19:34:02.783Z"
      "id" : "device2",
      "lastCommunication": "2021-08-05T19:34:02.783Z"

that’s why I suggested it be something like composite state in node Get: Devices, which could be optional.