Sonoff Device Offline

is there a way to check if sonoff device gets offline Then perfom other task?