ronengr / hass_nuki_bt

Control Nuki Lock over bluetooth
MIT License
32 stars 7 forks source link

Cannot configure Nuki Smart Lock 3 #26

Closed guibar closed 7 months ago

guibar commented 7 months ago

System Health details

System Information

version core-2023.11.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.21-v8
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.33.0 Stage | running Available Repositories | 1395 Downloaded Repositories | 3
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 22 November 2023 at 01:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | eu-central-1-14.ui.nabu.casa certificate_status | ready can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.1 -- | -- update_channel | stable supervisor_version | supervisor-2023.11.0 agent_version | 1.6.0 docker_version | 24.0.6 disk_total | 57.8 GB disk_used | 6.1 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.6.0), Terminal & SSH (9.8.0), SQLite Web (3.10.0)
Dashboards dashboards | 2 -- | -- resources | 0 views | 2 mode | storage
Recorder oldest_recorder_run | 3 November 2023 at 13:56 -- | -- current_recorder_run | 10 November 2023 at 17:42 estimated_db_size | 132.04 MiB database_engine | sqlite database_version | 3.41.2

Checklist

Describe the issue

I cannot configure sucessfully the configuration of my Nuki Smart lock. I am using the bluetooth capability of my Raspberry Pi 4. The lock is discovered and I am offered a button to configure it. When I do, following the instructions, I end up with an Error message in a popup with no extra explanations. I see in the logs 3 different errors which I have pasted below.

Reproduction steps

  1. Installed integration
  2. Followed exactly the steps in the documentation all the way to "Select "Pair device automatically""

Debug logs

Logger: pyNukiBT.nuki
Source: runner.py:188
First occurred: 14:15:54 (12 occurrences)
Last logged: 14:19:29

HomeAssistant: Received unsolicited notification: Container: auth_id = b'\xe4\\4\x00' (total 4) command = (enum) CHALLENGE 4 payload = Container: nonce = b'\xcf\x0e\x17xoW\x84%^<-\x1a\x11T\x06D'... (truncated, total 32) crc = 29283
was expecting CONFIG
was expecting CHALLENGE
HomeAssistant: Received unsolicited notification: Container: auth_id = b'\xe6\\4\x00' (total 4) command = (enum) CHALLENGE 4 payload = Container: nonce = b'\x99\xeeC\x9f\xd0>m+\xf3\xde\xc93xNB)'... (truncated, total 32) crc = 1542

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: 14:15:29 (20 occurrences)
Last logged: 14:20:43

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 269, in _notification_handler
    msg = self._parse_message(bytes(data), encrypted)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 199, in _parse_message
    msg = self._const.NukiMessage.parse(self._decrypt_message(data))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 288, in parse
    return self.parse_stream(io.BytesIO(data), **contextkw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 300, in parse_stream
    return self._parsereport(stream, context, "(parsing)")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport
    obj = self._parse(stream, context, path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 2120, in _parse
    subobj = sc._parsereport(stream, context, path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport
    obj = self._parse(stream, context, path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 2653, in _parse
    return self.subcon._parsereport(stream, context, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport
    obj = self._parse(stream, context, path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyNukiBT/const.py", line 948, in _parse
    hash1 = self.checksumfield._parsereport(stream, context, path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport
    obj = self._parse(stream, context, path)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 1041, in _parse
    data = stream_read(stream, self.length, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/construct/core.py", line 91, in stream_read
    raise StreamError("stream read less than specified amount, expected %d, found %d" % (length, len(data)), path=path)
construct.core.StreamError: Error in path (parsing) -> crc
stream read less than specified amount, expected 2, found 1

Logger: homeassistant
Source: components/bluetooth/update_coordinator.py:53
First occurred: 14:16:14 (10 occurrences)
Last logged: 14:21:03

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hass_nuki_bt/__init__.py", line 80, in async_setup_entry
    raise ConfigEntryNotReady(f"{address} is not advertising state")
homeassistant.exceptions.ConfigEntryNotReady: 54:D2:72:96:44:7C is not advertising state

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 488, in _async_setup_again
    await self.async_setup(hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 464, in async_setup
    await self._async_process_on_unload(hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 703, in _async_process_on_unload
    if job := self._on_unload.pop()():
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/update_coordinator.py", line 53, in _async_cancel
    self._async_stop()
TypeError: 'bool' object is not callable

Diagnostics dump

No response

guibar commented 7 months ago

After doing a firmware upgrade to my lock, it ended up working.