Automatically switch to online and offline status