Skip to content

aioble - multiple connections to a peripheral? #9775

Answered by ser
ser asked this question in Libraries & Drivers
Discussion options

You must be logged in to vote

Thanks for explanation, but I believe your code misses necessary await, it should be:

async def server_task(connection):
  print("Connection from", connection.device)
  await connection.disconnected()

async def peripheral_task():
  while True:
    connection = await aioble.advertise(
            _ADV_INTERVAL_MS,
            name="mpy-temp",
            services=[_ENV_SENSE_UUID],
            appearance=_ADV_APPEARANCE_GENERIC_THERMOMETER
    )
    asyncio.create_task(server_task(connection))

This works correctly for me. Thanks again!

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@gooostaw
Comment options

Comment options

You must be logged in to vote
4 replies
@jimmo
Comment options

@ser
Comment options

@jimmo
Comment options

@brianreinhold
Comment options

Answer selected by ser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants