async def start(self):
if self.connection.connected:<EOL><INDENT>return<EOL><DEDENT>await self.connection.connect()<EOL>if self.service.device_credentials:<EOL><INDENT>self.srp.pairing_id = Credentials.parse(<EOL>self.service.device_credentials).client_id<EOL><DEDENT>msg = messages.device_information(<EOL>'<STR_LIT>', self.srp.pairing_id.decode())<EOL>await self.send_and_receive(msg)<EOL>self._initial_message_sent = True<EOL>await self.send(messages.set_ready_state())<EOL>async def _wait_for_updates(_, semaphore):<EOL><INDENT>semaphore.release()<EOL><DEDENT>semaphore = asyncio.Semaphore(value=<NUM_LIT:0>, loop=self.loop)<EOL>self.add_listener(_wait_for_updates,<EOL>protobuf.SET_STATE_MESSAGE,<EOL>data=semaphore,<EOL>one_shot=True)<EOL>await self.send(messages.client_updates_config())<EOL>await self.send(messages.wake_device())<EOL>try:<EOL><INDENT>await asyncio.wait_for(<EOL>semaphore.acquire(), <NUM_LIT:1>, loop=self.loop)<EOL><DEDENT>except asyncio.TimeoutError:<EOL><INDENT>pass<EOL><DEDENT>
Connect to device and listen to incoming messages.