From afa7631e80fae1a8d74ae53d862247b59577712d Mon Sep 17 00:00:00 2001 From: ludeeus Date: Sat, 1 Dec 2018 18:12:52 +0100 Subject: [PATCH] Adds get_devices function --- googledevices/api/bluetooth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/googledevices/api/bluetooth.py b/googledevices/api/bluetooth.py index 9529a4d..d5eb390 100644 --- a/googledevices/api/bluetooth.py +++ b/googledevices/api/bluetooth.py @@ -89,6 +89,13 @@ async def get_scan_result(self): _LOGGER.error('Error connecting to %s - %s', self._ipaddress, error) + async def get_devices(self, sleep=5): + """Get bluetooth devices.""" + await self.scan_for_devices() + await asyncio.sleep(sleep) + await self.get_scan_result + return self.devices + async def scan_for_devices_multi_run(self, runs=2): """Scan for devices multiple times.""" run = 1