change state on plugging/unplugging