Get Device Activity from REST API?

I’m looking to get the reported activity for a particular device from the Smartthings REST API (https://smartthings.developer.samsung.com/develop/api-ref/st-api.html#section/Overview)

Purpose: I have a basement ejector pump that likes to sometimes get stuck. I have a shock sensor attached to a pipe that triggers when the pump engages. I’d like to poll the device and know if it hasn’t triggered for a particular period and create an alert so that I know the float switch might be stuck.

As far as I’m concerned, getting the last activity value for a device from the API would be the easiest way for me to apply this solution. However, I don’t see anything in the documentation that will display a device’s Last Activity (like in the IDE).

Can you not use the simple device viewer smartapp? It’s very popular for similar use cases. :sunglasses:

2 Likes

You can also use Device monitor.

3 Likes

Excellent suggestions, thank you.

While Device Monitor appears it will do the trick in some fashion, I was still hoping I could use the API to view the last update timestamp. The reason being is that I would like to tie the alerts into a real notification system like PagerDuty.

If you don’t have a device forcing an update, the last update timestamp won’t change. You can’t do this all from the API.

I don’t want the lastUpdate value to change. I just need to be able to read something that tells me what the lastUpdate timestamp was for the device.

One would expect this information to be contained in the /devices//status output of the REST API, but I only see the current device state… not lastUpdate or lastActivity…