Skip to content

Commit

Permalink
Fix bluetooth tracker asyncio usage (#94695)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
d03n3rfr1tz3 committed Jun 16, 2023
1 parent 45bf123 commit 3440c16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion homeassistant/components/bluetooth_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ async def perform_bluetooth_update() -> None:
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)
Expand Down

0 comments on commit 3440c16

Please sign in to comment.