This question has developed out of a thread on the webCoRE forum.
Although very little about device health has ever been documented, it used to be the case that the DeviceWatch-DeviceStatus attribute of the Health Check capability was updated with the online/offline status of a device, and I believe the same was also true of healthStatus. It was possible for legacy apps to subscribe to this attribute and so trigger automations based on the changes, and yes I am particularly talking about webCoRE and pistons.
That seems to have all stopped on October 5th. I assume healthStatus and DeviceWatch-DeviceStatus can still be used to set the connectivity status of untracked or cloud based devices, it certainly seems to still be possible to get the current status using device.getStatus() in legacy apps (aka $status in webCoRE), and new integrations can presumably use the Health API. However, if there is still a way for legacy apps to subscribe to changes in the connectivity status, it isn’t leaping out at me.
I can well imagine having overlooked something as none of this stuff has really ever been explained to the punters. So have I?
I’m looking to add device health to my roomba dth, but since it’s connecting via an intermediary server I’ve had to build a way to ping the actual robot just to make sure it’s connected to wifi. I can get the actual IP of the robot from the API.
The idea is that your server is likely always online, but the robot may lose WiFi connectivity due to battery etc.
I also found that my sendHubEvent for polling the API still ran even if the server was set to a nonsensical IP. I’m not sure how to make it return something indicating that it failed? Should I just ping the server also?
Can I do sendEvent(“healthStatus”, value: “offline”) ? Is this correct?
I don’t think I need to use DeviceWatch-Enroll because I’ve already set it up to regularly check the device status, and I don’t need to set the checkInterval because I’m just using the regular polling interval (I’m pinging the device before every API poll).