Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method "Connect" with signature "" ... doesn't exist #238

Closed
Matt-Hicks-Bose opened this issue Jul 2, 2020 · 2 comments
Closed

Method "Connect" with signature "" ... doesn't exist #238

Matt-Hicks-Bose opened this issue Jul 2, 2020 · 2 comments
Assignees
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend
Milestone

Comments

@Matt-Hicks-Bose
Copy link

Matt-Hicks-Bose commented Jul 2, 2020

  • bleak version: 0.7.0
  • Python version: 3.7.3
  • Operating System: Raspbian GNU/Linux 10 (buster)
  • BlueZ version (bluetoothctl -v) in case of Linux: 5.50

Description

Trying to connect to a non-existent BLE device results in an exception. I am seeing this occur in my application code, but also with the examples get_services.py and service_explorer.py (by not changing the default MAC address in the examples).

What I Did

$ python3 service_explorer.py
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 151, in connect
    ).asFuture(self.loop)
txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownObject: Method "Connect" with signature "" on interface "org.bluez.Device1" doesn't exist


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "service_explorer2.py", line 63, in <module>
    loop.run_until_complete(run(address, loop, True))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "service_explorer2.py", line 29, in run
    async with BleakClient(address, loop=loop) as client:
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/client.py", line 49, in __aenter__
    await self.connect()
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 154, in connect
    raise BleakError(str(e))
bleak.exc.BleakError: org.freedesktop.DBus.Error.UnknownObject: Method "Connect" with signature "" on interface "org.bluez.Device1" doesn't exist
@Matt-Hicks-Bose Matt-Hicks-Bose changed the title Method "Connect Method "Connect" with signature "" ... doesn't exist Jul 2, 2020
@hbldh
Copy link
Owner

hbldh commented Jul 2, 2020

Trying to connect to a non-existent BLE device results in an exception.

Well, shouldn't it throw an exception? Maybe a better one though, e.g. a BleakError.

It generally means that the BlueZ deamon does not have a device with that address stored in its list of discovered devices. Run discover for longer or set timeout higher in the BleakClient.

@hbldh hbldh self-assigned this Jul 2, 2020
@hbldh hbldh added the Backend: BlueZ Issues and PRs relating to the BlueZ backend label Jul 2, 2020
@hbldh hbldh added this to the Version 0.7.1 milestone Jul 2, 2020
@hbldh hbldh mentioned this issue Jul 2, 2020
@hbldh hbldh closed this as completed in d78d78d Jul 2, 2020
@Matt-Hicks-Bose
Copy link
Author

Thanks, that is a better error description and should reduce confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend
Projects
None yet
Development

No branches or pull requests

2 participants