How would I use the API to find out the last time a device reported any data?
If you’re in a workflow, you can grab this information using the device get node:
The result will contain a property called
connectionInfo . Like so:
time is the last time Losant saw a connection from the device.
If you’re not within a workflow and you would still like to use the Losant API. The Device Get API will return the same info above. More info:
Sorry, totally misread your question! The above is to get the last known connection status.
To get the last time the device reported state:
This is also doable with the Device: Get Node. But, the composite will contain all attributes, the last value reported, and time reported.
With this endpoint, you can query via attribute and grab multiple devices.
So, you have options
So to clarify, I’m not in a Losant workflow, and just want to know the last time the devices successfully posted any sensor data.
Yup! The two API calls in my last response should get you exactly what you need.
If you just want to visually see it, the Debug Tab on the device page will show you “Recent Device States”. This includes the most recently received states with their timestamps.