Smart independent dog knows what to do before going to sleep