A couple of pointers would be great - Lan connected devices

So, Having spent the last few months in a javascript and smartthings abyss, I think I finally have some decent and working code.

I am about to embark in a google attempt to solve one of my remaining problems,
and I wondered whether any kind soul might be able to help.

Essentially, my lan smartapp managing my lan connected devices could find one of it’s child devices to be ‘unavailable’. Could you point me to the best examples of how a smartapp manages this in the phone/tablet app?

Also, I notice that the hue apps and devicehandlers are now incorporated in smartthings and the code in the templates is ‘deprecated’ Is there anyway I can see the code that actually represents how they are implemented now?

Thanks in advance