add codes to check whether door is fully opened