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.
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.
Is there a callback for when these occur? My driver has a hub device with many children. If the hub goes offline, the children are automatically marked offline. When the hub comes back online, I would like to be able to tell the child devices to try and update their status as well.
When the hub is rebooted or there was a power outage, the driver is restarted and the init lifecycle is executed for each device (the order parent-children is not guaranteed). The init of the device object just means that the record of the SmartThings device has been created on the Lua side.
So, you could add a validation there as a quick check-up of their current status and send those commands
To be clear, I was referring to a non-ST hub. ST talks to a different Hub (Hue/Bond/SwitchBot) and adds child devices from those hubs/bridges. If that bridge device goes offline, it marks all of the child devices offline as well. But when that bridge comes back, there isnāt a callback to have the child devices check as well.
Mmm, I seeā¦Iām not aware of the method you defined to know the status of external Hub (offline/online) so ST knows if itās out or not.
In this LAN sample, thereās a ping function scheduled to check if the device is still responsive.
If you can configure a method like this in your Hub so it responds to the pings you define in ST and sends the status of the connected devices, I believe you wonāt need a callback when they get offline.
Is that something possible on your side?
Iām not sure the effect of device:refresh() in LAN devices, I will check that with the team.
I can ping and see if everything is online. If a device comes online, is there a callback within the same device? So if a device comes :online() I can have it do additional work like fetch its state from the LAN connected device. Basically, I would like to see online and offline become lifecycle callbacks that are triggered by calling device:online() and device:offline(). If this is not currently possible, I would like to make a feature request of the engineering team.
I can only poke at code, but I really need to be able to tell if a device is off in my barn. Does anyone have a working set of code and how to implement to send a notification in the app if a device status goes offline?
Is an always on pc still the only way to achieve this? I have a faulty August Connect plugged into a smart plugā¦ I have manually toggled the switch to clear connectivity issues, but itād be great to achieve this by rules or routinesā¦