[ST Edge] How to check online/offline status of device in a routine?

What if I need to create a routine that acts when device goes online/offline ?
What if I need to create a routine that acts when one of its precondition is the actual status of online device and not the last status before going offline ?

I thought I could use this capacity to create these routines.

There was a period when the Health Check capability displayed the online/offline status, but that stopped working quite some time ago now. I think it is still used in certain types of device integration to allow the status to be set via an attribute but other integrations like Edge simply don’t need it.

Device Health is now exposed via an API endpoint rather than via an attribute, and non-legacy SmartApps can subscribe to it, but I don’t think the Rules API, and so the Routines, can do anything with it yet. I’d be a bit surprised if Routines ever supported it.

What I have written above is a best guess. Getting reliable and consistent information about how to work with device health has never been easy.

1 Like

What is this endpoint for a zigbee device ?

Check Your Device’s Health | SmartThings Developers

I took out the power source of the device and made a request…

    "deviceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "state": "ONLINE",
    "lastUpdatedDate": "2022-01-11T01:04:21.234Z"

After ± 30 minutes, I retested and it returned…

    "deviceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "state": "OFFLINE",
    "lastUpdatedDate": "2022-01-11T01:34:24.609Z"

So yeah, thanks @orangebucket !

Do you know any way to check this status from the driver itself ?

Thanks for jumping in, @orangebucket. :smiley:
@w35l3y, health status can be accessed using a SmartApp as well.

You could create subscriptions to it and create automation based on that event. These are the functions you could use from the SmartThings Core SDK which the SmartApp SDK is based on.

In Edge drivers, the health status is handled automatically for Zigbee and Z-Wave. In LAN drivers, you could implement your own method and use the functions of device:online(), device:offline()

Can Health Status be set from a SmartApp? I would like to write a SmartApp replacement for Device Health - it seems to no longer function on zwave/zigbee DTH devices. I have many hardwired devices that are way over their checkInterval time, don’t get ping() called and never get marked OFFLINE.

No, it cannot be set through a SmartApp, but you can try using Edge drivers for your Zigbee and Z-Wave devices, they handle the device health automatically.
In the DTH, you had to enroll for the health check depending on the protocol but you don’t need to do that now.
There are some drivers already available here which you can have access to by enrolling your Hub in this channel (see more info about that at the bottom of this post.

All my devices are DTH currently and the ones that I’m inquiring about all enrolled in Health Check - but it appears to no longer be working. Polling is inconsistent too. I’m guessing they are related to the same problem.

For Edge, its not a “production ready” option for me at this point. Without the ability to see at least the following data from the Groovy IDE

  • Route (zwave and zigbee both)
  • Device Data (security level and other driver set data)
  • Current States
    Edge is not something I can switch to yet. I’ve played with it on our development hub but it can’t be used on our “production” (aka, the family uses it) hub yet.

Thanks for replying!

I see, well, for devices that are controlled Edge drivers, you can see several of their properties through the ST API, for example:

Field / Information Endpoint
networkId /devices
driverId /devices
executingLocally /devices
networkSecurityLevel /devices
parentDeviceId / hubId /devices
capability status/values /devices/deviceId/status
capability status/values /devices/deviceId/status
device health /devices/deviceId/health

If you want, I can report the issue with the device health using a DTH, to do so, please the following information over a direct message:

  • Device name and ID
  • if it’s a custom DTH, include its code. We can get more descriptions of the device from there (fingerprints)

PM sent. thank you so much for taking up my question/concern!