ble - put discovery back
This commit is contained in:
1 parent
4ef2d7c2af
commit
36b55ffc01
1 file changed
+12
-12
+12
-12
@@ -182,18 +182,18 @@ def _is_match(mac: str, name: str) -> bool:
|
|||||||
####################################################
|
####################################################
|
||||||
async def read_data(mac: str) -> Optional[SensorReading]:
|
async def read_data(mac: str) -> Optional[SensorReading]:
|
||||||
|
|
||||||
# try:
|
try:
|
||||||
# address = await asyncio.wait_for(
|
address = await asyncio.wait_for(
|
||||||
# _discover_device(mac),
|
_discover_device(mac),
|
||||||
# timeout=DISCOVER_TIMEOUT,
|
timeout=DISCOVER_TIMEOUT,
|
||||||
# )
|
)
|
||||||
# except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
# log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT)
|
log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT)
|
||||||
# return None
|
return None
|
||||||
#
|
|
||||||
# if not address:
|
if not address:
|
||||||
# return None
|
return None
|
||||||
address = mac
|
|
||||||
try:
|
try:
|
||||||
async with BleakClient(address, timeout=CONNECT_TIMEOUT) as client:
|
async with BleakClient(address, timeout=CONNECT_TIMEOUT) as client:
|
||||||
# NEW BLOCK ----------------------------------------------
|
# NEW BLOCK ----------------------------------------------
|
||||||
|
|||||||
Reference in new issue
Block a user