How does Flex detect motion on battery?