LANnouncer is a Device Handler so paste your code there. You will then use smart apps like BigTalker to create notifications when things happen.