Fix bluetooth tracker asyncio usage (#94695)

* fix for asyncio usage

fixes the error "Passing coroutines is forbidden, use tasks explicitly", caused by passing an async function into asyncio.wait directly instead of creating a task for it.

* removes unnecessary default param

* corrects formatting for black
This commit is contained in:
Dirk Sarodnick 2023-06-16 04:10:04 +02:00 committed by GitHub
parent 45bf1235d8
commit 3440c1615d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,11 @@ async def async_setup_scanner(
rssi = await hass.async_add_executor_job(client.request_rssi)
client.close()
tasks.append(see_device(hass, async_see, mac, friendly_name, rssi))
tasks.append(
asyncio.create_task(
see_device(hass, async_see, mac, friendly_name, rssi)
)
)
if tasks:
await asyncio.wait(tasks)