Hi all,
I am reading the Health Check documentation and it is extremely vague.
Opt in for health check
Devices must opt-in to have its health status checked on the platform. To enroll, the capability must be set when the device is installed. Please note that hubs do not need to be explicitly enrolled, when a hub is onboarded it is automatically enrolled by the system.
I get this point I think, in my device handler I need to have:
capability "Health Check"
Cant seem to find it in the capability reference though.
Querying my endpoint https://api.smartthings.com/v1/devices/{device_ID}/status
the healthCheck
capability is there and it has 4 attributes:
- checkInterval
- healthStatus
- DeviceWatch-Enroll
- DeviceWatch-DeviceStatus
checkinterval
Taken from the Health Check documentation
- Health check is a routine on the SmartThings platform that updates the connectivity status of a device or hub.
Is the routine check Interval
that I see defined in a lot of device handlers installed
methods? Something like shown below?
def installed() {
sendEvent(name: "checkInterval", value: 1860, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID, offlinePingable: "0"])
}
If so where is the documentation on checkInterval?
How does checkInterval
determine if a device is online/offline?
What attribute does checkInterval
change?
What is offlinePingable
?
healthStatus
This is constantly a value of null
and does not seem to update at all even when the checkInterval
is set in the device handler.
How is healthStatus
updated?
Is it linked in anyway to checkInterval
?
Do you have to manually update this?
DeviceWatch-Enroll
I have had some luck with this but still don’t understand why I need it if I have checkInterval
setup why am I enrolling the device as well?
What am I enrolling into here?
@nayelyz gave a snippet here on what to put in your handler if you want to use it.
DeviceWatch-DeviceStatus
This one seems to be linked to the DeviceWatch-Enroll
somehow. You can update the state of it by using the code shown in the snippet below.
sendEvent(name: "DeviceWatch-DeviceStatus", value: "online")
sendEvent(name: "DeviceWatch-DeviceStatus", value: "offline")
The above code does work to change the value of the device to either online
or offline
at the endpoint https://api.smartthings.com/v1/devices/{Device_ID}/health
How should this be used in a device handler practically through?
How could you ping a device and then detect no response in the device handler using the ping
method?
Maybe a timer and if the device hasn’t received a message in X amount of time set online
or offline
?
Has anyone done something like this in there device handler?
Should you do something like this or leave it to checkInterval
and whatever I have enrolled in with DeviceWatch-Enroll
The most detailed explanation I have seen is from @orangebucket here but even he is gives a warning that it should be taken lightly as there is no information on the subject.
Any clarity on how to monitor, update and keep track of a device status properly would be of help!
Thanks,
Warren