maritime-labs / calypso-anemometer

Python driver for the Calypso Instruments Ultrasonic Portable Solar wind meter (UP10)
GNU Affero General Public License v3.0
12 stars 2 forks source link

bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons) #22

Open UserMacUseface opened 1 year ago

UserMacUseface commented 1 year ago

Connection to device failed with:

Traceback (most recent call last):
  File "/usr/bin/calypso-anemometer", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/util.py", line 30, in wrapper
    return asyncio.run(func(*args, **kwargs))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/cli.py", line 188, in read
    await run_engine(workhorse=CalypsoDeviceApi, settings=settings, handler=handler)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 24, in run_engine
    await handler(calypso)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/core.py", line 86, in __aexit__
    raise exc_val
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 24, in run_engine
    await handler(calypso)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/engine.py", line 79, in handler
    await calypso.set_datarate(rate)
  File "/usr/lib/python3.9/site-packages/calypso_anemometer/core.py", line 217, in set_datarate
    await self.client.write_gatt_char(
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/client.py", line 690, in write_gatt_char
    assert_reply(reply)
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)

Subsequent connection attempt succeeded.

Could be handled with multiple connection retries.