Hi there! You could use the SmartApp SDK (Simple SmartApp tutorial).
The example below shows a subscription to the health events of all the devices in a location. When a device status changes from online to offline or vice versa, you’ll receive an event to the handler with this information:
{
eventId: 'xxxx-xxxx-xxxx',
locationId: 'xxxx-xxxx-xxxx',
deviceId: 'xxxx-xxxx-xxxx',
hubId: 'xxxx-xxxx-xxxx',
status: 'ONLINE',
reason: 'NONE'
}
For more information about the configuration page and settings options, see this document