ronengr / hass_nuki_bt

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

Error on locking #38

Closed Ayuus closed 2 months ago

Ayuus commented 4 months ago

System Health details

System Information

version core-2024.2.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.6.16-haos
arch aarch64
timezone Europe/Amsterdam
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1406 Downloaded Repositories | 19
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.0 -- | -- update_channel | stable supervisor_version | supervisor-2024.02.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 56.6 GB disk_used | 18.6 GB healthy | true supported | true board | odroid-n2 supervisor_api | ok version_api | ok installed_addons | File editor (5.8.0), Terminal & SSH (9.9.0), ESPHome (2024.2.1), OneDrive Backup (2.3), Network UPS Tools (0.13.0), Dynu DNS (1.0.0), Piper (1.5.0), Whisper (1.0.2), openWakeWord (1.10.0)
Dashboards dashboards | 2 -- | -- resources | 9 views | 14 mode | storage
Recorder oldest_recorder_run | 18 februari 2024 om 03:24 -- | -- current_recorder_run | 27 februari 2024 om 01:23 estimated_db_size | 842.16 MiB database_engine | sqlite database_version | 3.44.2
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

Lock was stuck (state = LOCKING). tryning to lock gave excepton, refer to debug log below.

Reproduction steps

  1. Lock Nuki
  2. .

Debug logs

Logger: homeassistant.components.automation.berging_vergrendelen_indien_te_lang_locking_2
Source: helpers/script.py:485
Integration: Automatisering (documentation, issues)
First occurred: 00:00:31 (1 occurrences)
Last logged: 00:00:31

Voordeur vergrendelen indien te lang locking: Error executing script. Unexpected error for call_service at pos 1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 362, in _send_command
    msg = await self._notify_future
          ^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 215, in async_handle_lock_service
    await self.async_lock(**self.add_default_code(kwargs))
  File "/config/custom_components/hass_nuki_bt/lock.py", line 49, in async_lock
    await self.async_lock_action(NukiLockConst.LockAction.LOCK)
  File "/config/custom_components/hass_nuki_bt/entity.py", line 76, in async_lock_action
    msg = await self.device.lock_action(action, name_suffix=user_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 457, in lock_action
    msg = await self._send_encrtypted_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 189, in _send_encrtypted_command
    return await self._send_command(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 361, in _send_command
    async with async_timeout.timeout(self.command_response_timeout):
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 141, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 228, in _do_exit
    raise asyncio.TimeoutError
TimeoutError

Diagnostics dump

No response

ronengr commented 2 months ago

@Ayuus timeout error when sending command is an indication of connection issues. in this case, we didn't get a response from nuki in time.

try placing the BT adapter closer to the nuki lock