ble - put discovery back

This commit is contained in:
matt committed 2026-10-21 20:26:08 -07:00
1 parent 4ef2d7c2af
commit 36b55ffc01
1 file changed
+12 -12
+12 -12
View File
@@ -182,18 +182,18 @@ def _is_match(mac: str, name: str) -> bool:
####################################################
async def read_data(mac: str) -> Optional[SensorReading]:
# try:
# address = await asyncio.wait_for(
# _discover_device(mac),
# timeout=DISCOVER_TIMEOUT,
# )
# except asyncio.TimeoutError:
# log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT)
# return None
#
# if not address:
# return None
address = mac
try:
address = await asyncio.wait_for(
_discover_device(mac),
timeout=DISCOVER_TIMEOUT,
)
except asyncio.TimeoutError:
log.warning("Device discovery timed out for %s after %.1fs", mac, DISCOVER_TIMEOUT)
return None
if not address:
return None
try:
async with BleakClient(address, timeout=CONNECT_TIMEOUT) as client:
# NEW BLOCK ----------------------------------------------