Add Power off detection Function