bleak: bleak.exc.BleakDBusError

  • bleak version: 0.15.1
  • Python version: 3.9
  • Operating System: bullseye
  • BlueZ version (bluetoothctl -v) in case of Linux: 5.55-3.1+rpt1

Description

Want to integrate eq3 thermostat and testing the connection. eq3cli --mac 00:1A:22:08:BF:D6

Scan was working, see the MAC address.

What I Did

Have placed the device about 2 meters from BT - USB stick, made scan, was working. (also tried bluetoothctl power off / bluetoothctl power on - with no changes in result)

 eq3cli --mac 00:1A:22:08:BF:D6
WARNING:bleak.backends.bluezdbus.client:Failed to cancel connection (/org/bluez/hci0/dev_00_1A_22_08_BF_D6):
WARNING:bleak.backends.bluezdbus.client:Failed to cancel connection (/org/bluez/hci0/dev_00_1A_22_08_BF_D6):
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/bleakconnection.py", line 51, in __enter__
    self._loop.run_until_complete(self._conn.connect())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/client.py", line 167, in connect
    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] Disconnected early

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/bleakconnection.py", line 57, in __enter__
    self._loop.run_until_complete(self._conn.connect())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/client.py", line 167, in connect
    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] Disconnected early

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/eq3cli", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/eq3cli.py", line 47, in cli
    thermostat.update()
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/bleakconnection.py", line 106, in make_request
    with self:
  File "/usr/local/lib/python3.9/dist-packages/eq3bt/bleakconnection.py", line 60, in __enter__
    raise BackendException(
eq3bt.BackendException: unable to connect to device using bleak

Any idea what can be the reason? (was working before with old Home Assistant installation at same Raspberry with same adapter - but software was updated)

Thanks!

About this issue

Most upvoted comments

ii  bluez                                      5.53-0ubuntu3.6                     amd64        Bluetooth tools and daemons
ii  bluez-cups                                 5.53-0ubuntu3.6                     amd64        Bluetooth printer driver for CUPS
ii  bluez-obexd                                5.53-0ubuntu3.6                     amd64        bluez obex daemon

@TechHummel, your problems do not seem to match the description of the issue here so should be discussed elsehwere. I would suggest starting a new discussion for that rather than a new issue for this unless you are 90% certain there is actually a bug in Bleak.