dauden1184 / RaspiNukiBridge

Simple Nuki Bridge implementation using asyncio
GNU General Public License v3.0
48 stars 19 forks source link

Access Denied: Rejected send message, 2 matched rules; #27

Closed wendelb closed 1 year ago

wendelb commented 1 year ago

First of all, thanks for creating and maintaing the project.

I wanted to try and connect to my Nuki Smart Lock 3 using my Raspi 3B using the library in this repository. Sadly something goes wrong in the pairing process:

$ python . --pair xx:xx:xx:xx:xx:xx
2023-11-30 22:43:52.604|I|__main__.py:278|Generatig keys for Nuki xx:xx:xx:xx:xx:xx
2023-11-30 22:43:52.606|I|__main__.py:282|bridge_public_key: <pubic-key>
2023-11-30 22:43:52.606|I|__main__.py:283|bridge_private_key: <private-key>
2023-11-30 22:43:52.608|I|nuki.py:173|Stop scanning
2023-11-30 22:43:52.609|I|nuki.py:570|Nuki connecting
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<Nuki.pair() done, defined at /home/pi/Downloads/RaspiNukiBridge/./nuki.py:639> exception=BleakDBusError('org.freedesktop.DBus.Error.AccessDenied', 'Rejected send message, 2 matched rules; type="method_call", sender=":1.248417" (uid=1000 pid=8609 comm="python . --pair xx:xx:xx:xx:xx:xx ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=8400 comm="/usr/lib/bluetooth/bluetoothd ")')>
Traceback (most recent call last):
  File "/home/pi/Downloads/RaspiNukiBridge/./nuki.py", line 644, in pair
    await self.connect()
  File "/home/pi/Downloads/RaspiNukiBridge/./nuki.py", line 571, in connect
    await self._client.connect()
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 112, in connect
    device = await BleakScannerBlueZDBus.find_device_by_address(
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/scanner.py", line 220, in find_device_by_address
    return await cls.find_device_by_filter(
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/scanner.py", line 249, in find_device_by_filter
    async with cls(detection_callback=apply_filter, **kwargs):
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/scanner.py", line 95, in __aenter__
    await self.start()
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start
    assert_reply(reply)
  File "/home/pi/Downloads/RaspiNukiBridge/venv/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.AccessDenied] Rejected send message, 2 matched rules; type="method_call", sender=":1.248417" (uid=1000 pid=8609 comm="python . --pair xx:xx:xx:xx:xx:xx ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=8400 comm="/usr/lib/bluetooth/bluetoothd ")

Used software stack:

The error occures when the Nuki is in paring mode. When the pairing mode times out and the command is run again, the same error is raised.

I initiated the pairing process with bluez 5.55 (the most recent version) and that yielded a different error: bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Software caused connection abort

As I don't have a clue what the error means, is this something I need to fix on my end?

wendelb commented 1 year ago

Okay, it just decided to start working. Upgraded bluez back to 5.55, restarted the bluetooth daemon and it connected successfully