How to know if devices is connected to network?

Use free plugin (VaRest) and ping to (Google)
If return more then (“0”), that mean internet is connect.