Sleep mode preparation

Added counter for auto sleep mode