Closed t0bse closed 1 year ago
You need to put the nuki in pairing mode before
You need to put the nuki in pairing mode before
i know. did that with both for a few times. pairing mode is active
OK so I had the same issue as you and it's not because of the pairing mode (I had that too, my bad) but because you're using python 3.9. You have to use to 3.7
connecting works with 3.7, but i get the "bluez" error.
pi@raspberrypi:~/RaspiNukiBridge $ python . --unlock
2022-10-01 14:49:05.254|I|nuki.py:586|Unlocking
2022-10-01 14:49:05.256|I|nuki.py:173|Stop scanning
2022-10-01 14:49:05.256|I|nuki.py:543|Nuki connecting
2022-10-01 14:49:15.948|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.bluez.Error.Failed] Software caused connection abort
Traceback (most recent call last):
File "/home/pi/RaspiNukiBridge/./nuki.py", line 517, in _send_data
await self.connect()
File "/home/pi/RaspiNukiBridge/./nuki.py", line 544, in connect
await self._client.connect()
File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 278, in connect
assert_reply(reply)
File "/home/pi/.local/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.bluez.Error.Failed] Software caused connection abort
2022-10-01 14:49:16.959|I|nuki.py:173|Stop scanning
2022-10-01 14:49:16.960|I|nuki.py:543|Nuki connecting
^CTraceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/pi/RaspiNukiBridge/./__main__.py", line 274, in <module>
asyncio.run(device.unlock())
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 629, in run_until_complete
self.run_forever()
File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
File "/usr/lib/python3.9/asyncio/base_events.py", line 1854, in _run_once
event_list = self._selector.select(timeout)
File "/usr/lib/python3.9/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
and after downgrading bluez to 5.50-1.2~deb10u2 armhf it's still not working:
2022-10-01 14:44:36.040|I|nuki.py:586|Unlocking
2022-10-01 14:44:36.042|I|nuki.py:173|Stop scanning
2022-10-01 14:44:36.043|I|nuki.py:543|Nuki connecting
2022-10-01 14:44:36.071|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.freedesktop.DBus.Error.AccessDenied] Rejected send message, 2 matched rules; type="method_call", sender=":1.34" (uid=1000 pid=1200 comm="python3.9 . --unlock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=509 comm="/usr/lib/bluetooth/bluetoothd ")
Traceback (most recent call last):
File "/home/pi/RaspiNukiBridge/./nuki.py", line 517, in _send_data
await self.connect()
File "/home/pi/RaspiNukiBridge/./nuki.py", line 544, in connect
await self._client.connect()
File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 112, in connect
device = await BleakScannerBlueZDBus.find_device_by_address(
File "/home/pi/.local/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/.local/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/.local/lib/python3.9/site-packages/bleak/backends/scanner.py", line 95, in __aenter__
await self.start()
File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start
assert_reply(reply)
File "/home/pi/.local/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.34" (uid=1000 pid=1200 comm="python3.9 . --unlock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=509 comm="/usr/lib/bluetooth/bluetoothd ")
Logs say you're still using python 3.9
Le sam. 1 oct. 2022, 15:45, t0bse @.***> a écrit :
connecting works with 3.7, but i get the "bluez" error. and after downgrading it's still not working:
``2022-10-01 14:44:36.040|I|nuki.py:586|Unlocking 2022-10-01 14:44:36.042|I|nuki.py:173|Stop scanning 2022-10-01 14:44:36.043|I|nuki.py:543|Nuki connecting 2022-10-01 14:44:36.071|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.freedesktop.DBus.Error.AccessDenied] Rejected send message, 2 matched rules; type="method_call", sender=":1.34" (uid=1000 pid=1200 comm="python3.9 . --unlock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=509 comm="/usr/lib/bluetooth/bluetoothd ") Traceback (most recent call last): File "/home/pi/RaspiNukiBridge/./nuki.py", line 517, in _send_data await self.connect() File "/home/pi/RaspiNukiBridge/./nuki.py", line 544, in connect await self._client.connect() File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 112, in connect device = await BleakScannerBlueZDBus.find_device_by_address( File "/home/pi/.local/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/.local/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/.local/lib/python3.9/site-packages/bleak/backends/scanner.py", line 95, in aenter* await self.start() File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start assert_reply(reply) File "/home/pi/.local/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.34" (uid=1000 pid=1200 comm="python3.9 . --unlock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=509 comm="/usr/lib/bluetooth/bluetoothd ")
— Reply to this email directly, view it on GitHub https://github.com/dauden1184/RaspiNukiBridge/issues/14#issuecomment-1264369877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVCK3YC7WHY6K5VMXWPJXLWBA6A3ANCNFSM6AAAAAAQJLWSSI . You are receiving this because you commented.Message ID: @.***>
Logs say you're still using python 3.9 Le sam. 1 oct. 2022, 15:45, t0bse @.***> a écrit : …
oops sorry thank you. but python 3.7... and bluez Version: 5.50-1.2~deb10u2
pi@raspberrypi:~/RaspiNukiBridge $ python . --lock
2022-10-01 19:04:14.733|I|nuki.py:579|Locking nuki
2022-10-01 19:04:14.735|I|nuki.py:173|Stop scanning
2022-10-01 19:04:14.735|I|nuki.py:543|Nuki connecting
2022-10-01 19:04:14.767|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.freedesktop.DBus.Error.AccessDenied] Rejected send message, 2 matched rules; type="method_call", sender=":1.69" (uid=1000 pid=48268 comm="python . --lock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=48089 comm="/usr/lib/bluetooth/bluetoothd ")
Traceback (most recent call last):
File "./nuki.py", line 517, in _send_data
await self.connect()
File "./nuki.py", line 544, in connect
await self._client.connect()
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 113, in connect
self.address, timeout=timeout, adapter=self._adapter
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 223, in find_device_by_address
**kwargs,
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 249, in find_device_by_filter
async with cls(detection_callback=apply_filter, **kwargs):
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 95, in __aenter__
await self.start()
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start
assert_reply(reply)
File "/usr/local/lib/python3.7/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.69" (uid=1000 pid=48268 comm="python . --lock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=48089 comm="/usr/lib/bluetooth/bluetoothd ")
with SUDO python . --unlock:
pi@raspberrypi:~/RaspiNukiBridge $ sudo python . --unlock
2022-10-01 19:16:20.485|I|nuki.py:586|Unlocking
2022-10-01 19:16:20.486|I|nuki.py:173|Stop scanning
2022-10-01 19:16:20.487|I|nuki.py:543|Nuki connecting
2022-10-01 19:16:23.162|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.bluez.Error.Failed] Software caused connection abort
Traceback (most recent call last):
File "./nuki.py", line 517, in _send_data
await self.connect()
File "./nuki.py", line 544, in connect
await self._client.connect()
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 278, in connect
assert_reply(reply)
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Software caused connection abort
but this works ... ??
If you scan for devices via Bluetoothctl do you find your nuki?
`#bluetoothctl
Le sam. 1 oct. 2022, 20:06, t0bse @.***> a écrit :
Logs say you're still using python 3.9 Le sam. 1 oct. 2022, 15:45, t0bse @.***> a écrit : … <#m2038364590532723894>
oops sorry thank you. but python 3.7... and bluez Version: 5.50-1.2~deb10u2
@.***:~/RaspiNukiBridge $ python . --lock
2022-10-01 19:04:14.733|I|nuki.py:579|Locking nuki
2022-10-01 19:04:14.735|I|nuki.py:173|Stop scanning
2022-10-01 19:04:14.735|I|nuki.py:543|Nuki connecting
2022-10-01 19:04:14.767|E|nuki.py:523|Error: <class 'bleak.exc.BleakDBusError'> [org.freedesktop.DBus.Error.AccessDenied] Rejected send message, 2 matched rules; type="method_call", sender=":1.69" (uid=1000 pid=48268 comm="python . --lock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=48089 comm="/usr/lib/bluetooth/bluetoothd ")
Traceback (most recent call last):
File "./nuki.py", line 517, in _send_data
await self.connect()
File "./nuki.py", line 544, in connect
await self._client.connect()
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 113, in connect
self.address, timeout=timeout, adapter=self._adapter
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 223, in find_device_by_address
**kwargs,
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 249, in find_device_by_filter
async with cls(detection_callback=apply_filter, **kwargs):
File "/usr/local/lib/python3.7/site-packages/bleak/backends/scanner.py", line 95, in aenter
await self.start()
File "/usr/local/lib/python3.7/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start
assert_reply(reply)
File "/usr/local/lib/python3.7/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.69" (uid=1000 pid=48268 comm="python . --lock ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=48089 comm="/usr/lib/bluetooth/bluetoothd ")
— Reply to this email directly, view it on GitHub https://github.com/dauden1184/RaspiNukiBridge/issues/14#issuecomment-1264440900, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVCK3YTBDIQSMIGT2BRUULWBB4RHANCNFSM6AAAAAAQJLWSSI . You are receiving this because you commented.Message ID: @.***>
If you scan for devices via Bluetoothctl do you find your nuki?
#bluetoothctl #scan on #devices
Le sam. 1 oct. 2022, 20:06, t0bse @.***> a écrit : …
yes. maybe the bluetooth connection is not the best? (RSSI: -80) it worked for the first time now, without changing anything... sometimes this is happening only, after "connected" it finishes:
pi@raspberrypi:~/RaspiNukiBridge $ sudo python . --lock
2022-10-01 19:47:11.700|I|nuki.py:579|Locking nuki
2022-10-01 19:47:11.701|I|nuki.py:173|Stop scanning
2022-10-01 19:47:11.701|I|nuki.py:543|Nuki connecting
2022-10-01 19:47:16.666|I|nuki.py:247|Device type: DeviceType.SMARTLOCK_1_2
2022-10-01 19:47:20.739|I|nuki.py:555|Connected
i ran it a second time with 5 replies, and on the third reply, it worked. next try, with locking the door, is not working.
but i also set the timeout to 30 seconds and the "software caused connection abort" error is showing every 5 seconds
Yeah i think it's due to the timeout. In real conditions you don't normally open and close and open it via the bridge so if it works every 30s i think it's fine.
On my end after a reboot of my pi i also had the BleakDBusError too.
I managed to fix it by running the service with the root user, and therefore changing the User in the systemd service :
`[Unit] Description=Nuki bridge After=network-online.target
[Service] Type=simple Restart=always RestartSec=1 User=root WorkingDirectory=/home/pi/RaspiNukiBridge/ ExecStart=python3 .
[Install] WantedBy=multi-user.target`
Glad yours is working :D
Raspberry Pi 3B tested Nuki v2 and v3
v2:
v3: