Skip to content

Commit

Permalink
fix for asyncio usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
d03n3rfr1tz3 committed Jun 15, 2023
1 parent 19ebdfc commit 3c6ea8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/bluetooth_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ 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)
await asyncio.wait(tasks, return_when=asyncio.ALL_COMPLETED)

except bluetooth.BluetoothError:
_LOGGER.exception("Error looking up Bluetooth device")
Expand Down

0 comments on commit 3c6ea8f

Please sign in to comment.