You could probably do something like that but if you’re already writing code in an app, what I would suggest is that you create a heartbeat test to ensure that it is reporting status routinely (through one of the various reports that the ZEN15 sends). Then if it doesn’t “beat” you can have your app alert the user that it hasn’t heard from the device (any device really so it would be generic code) in a set time. I think that will be more reliable too because you have much less of a chance of missing the change in state.
I did this in my Sump Pump Monitor app, check out this thread which also has links to the app code in GitHub. You’ll want to look at the Initialize() function for the setup and then the deviceHeartbeat() and heartbeatAlert() functions. It’s as simple as start a timer and if I don’t get a heartbeat alert me, otherwise reset the timer and start again.
FYI, I may make a minor update to this code soon to improve a few other parts unrelated to the heartbeat - just doing some extended testing now.