Closed nov1n closed 1 year ago
So after setting up an ESP32 as a Bluetooth proxy the Nuki is detected. , When configuring automatically the wizard finishes, but it says 'Failed to setup' on the integrations page.
Logs:
2023-06-08 20:50:03.499 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Apartment door for hass_nuki_bt
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hass_nuki_bt/__init__.py", line 79, in async_setup_entry
if not await coordinator.async_wait_ready():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hass_nuki_bt/coordinator.py", line 148, in async_wait_ready
await self._async_update()
File "/config/custom_components/hass_nuki_bt/coordinator.py", line 108, in _async_update
await self.device.update_state()
File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 424, in update_state
self._const.NukiCommand.REQUEST_DATA,
^^^^^^^^^^^
AttributeError: 'NukiDevice' object has no attribute '_const'
Any ideas @ronengr ?
Regarding the first issue, it seems there is no BT controller available to HA that is in range of the Nuki. So basically there is either an issue with the BT on the RPI or the RPI is too far away from the Nuki for good communication. I see that adding a BT Proxy fixed this :-)
Regarding the 2nd issue, this is strange. what version of hass_nuki_bt are you using? Have you tried removing the device and re-discovering it?
I assumed having a Bluetooth enabled Raspberry Pi was enough, but apparently not.
I've tried everything that came to mind including your suggestion using version 0.0.5
, but no luck. In the end I switched to https://github.com/technyon/nuki_hub, which works well.
Having a BT enabled RPI should be enough. personally I have a CuBox with internal BT and is working perfectly to control the Nuki. I didn't try with RPI, but it should work. Did you add the BT adapter to HA? do you have other BT devices that HA can detect with RPI's BT? Could be an issue with the BT adapter or maybe distance/BT signal strength.
0.0.5 is the latest version, and it should work. It is strange you are getting this error. I will look at the code again and try to see if i can find the issue.
Maybe there was something wrong with my Bluetooth config. I'd rather not touch it now that it's working so I won't be able to give you more help with debugging.
If I'm the only one facing this problem it was likely me. I think there's definitely a case for not using an ESP so I hope your project will be successful!
Feel free to close this issue.
I am getting this error in conjunction with this warning:
2023-11-25 13:18:36.015 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hass_nuki_bt' attempted to call BleakClient with an address instead of a BLEDevice at custom_components/hass_nuki_bt/config_flow.py, line 151: ret = await device.pair(), please create a bug report at https://github.com/ronengr/hass_nuki_bt/issues
I'm also on a Pi 4B with builtin bluetooth. My Nuki lock is version 1.0. hass_nuki_bt version is 0.0.7.
EDIT: After moving the Pi closer (From 3 meters to 2 meters [maybe the BT signal strength on the nuki 1.0 isn't very good]) I still get this error but I also get different errors which I assume don't belong to this issue.
Same error here with NUKI 3 (not pro) and a raspberry pi located quite close to the NUKI. First time it did work but calling the service failed. After removing the integration and trying to pair again it immediately showed "ERROR" and the logs show:
File "/usr/local/lib/python3.11/site-packages/habluetooth/wrappers.py", line 379, in _async_get_best_available_backend_and_device raise BleakError( bleak.exc.BleakError: No backend with an available connection slot that can reach address 54:D2:XX:XX:XX:XX was found
@maryum375 if you are getting this error from bleak it means the computer cannot find a way to communicate with the Nuki BT device. either there is an issue with the BT adapter or there are interference or some other issues causing the connection issue. you can try moving the RPI closer or try adding an antenna to the RPI, or maybe use a BT proxy.
Unfortunately, if bleak (the underlying BT package for HA) cannot establish a connection to the device, there is nothing i can do
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.30.1 Stage | running Available Repositories | 1286 Downloaded Repositories | 10Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okDashboards
dashboards | 1 -- | -- resources | 3 views | 1 mode | storageRecorder
oldest_recorder_run | 21 May 2023 at 03:27 -- | -- current_recorder_run | 30 May 2023 at 20:04 estimated_db_size | 109.45 MiB database_engine | sqlite database_version | 3.40.1Spotify
api_endpoint_reachable | ok -- | --Checklist
Describe the issue
Cannot pair Nuki Smart Lock 3.0 using Raspberry Pi 4B with buit-in Bluetooth.
Reproduction steps
No Nuki device is automatically discovered.
I then tried adding the integration manually and filled out the device name and address. This takes me to the followup screen and after putting the Nuki in pairing mode and selecting 'Pair device automatically' I get an error.
Debug logs
Diagnostics dump
No response