ronengr / hass_nuki_bt

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

No Entities on Nuki #17

Closed pelegw closed 2 months ago

pelegw commented 9 months ago

System Health details

System Information

version core-2023.9.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.21-v8
arch aarch64
timezone Asia/Jerusalem
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4993 Installed Version | 1.32.1 Stage | running Available Repositories | 1289 Downloaded Repositories | 2
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | October 9, 2023 at 3:00 AM relayer_connected | true relayer_region | ap-southeast-1 remote_enabled | false remote_connected | false alexa_enabled | true google_enabled | true remote_server | ap-southeast-1-0.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 10.5 -- | -- update_channel | stable supervisor_version | supervisor-2023.09.2 agent_version | 1.5.1 docker_version | 23.0.6 disk_total | 28.5 GB disk_used | 6.3 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (15.0.8), Network UPS Tools (0.12.1), Amazon S3 Backup (1.1)
Dashboards dashboards | 1 -- | -- resources | 0 views | 2 mode | storage
Recorder oldest_recorder_run | September 13, 2023 at 12:54 AM -- | -- current_recorder_run | September 24, 2023 at 12:18 AM estimated_db_size | 19.82 MiB database_engine | sqlite database_version | 3.41.2

Checklist

Describe the issue

When adding a Nuki lock to HA, it is found and paired in bridge mode, however no data is received and no entities are seen. The following can be found in the HA logs:

Error setting up entry Door for hass_nuki_bt Error setting up entry Nuki_3637497C 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'

Reproduction steps

1.Nuki is detected by HA and pairing starts 2.Long press on Nuki for pairing mode 3.Pairing Finished 4.No entities shown for Nuki

Debug logs

2023-09-24 00:17:57.060 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hass_nuki_bt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-09-24 00:17:57.062 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-09-24 00:18:16.122 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 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'

Diagnostics dump

No response

pelegw commented 9 months ago

This is suddenly working now - the only thing I did was synchronize time on the lock. Weird.

pelegw commented 9 months ago

Never mind, it's back to the same error again. Really weird.

This is suddenly working now - the only thing I did was synchronize time on the lock. Weird.

ronengr commented 8 months ago

This is an interesting error. I will look into it

ronengr commented 8 months ago

I have released a new version that should fix this issue. can you please check?

pelegw commented 8 months ago

Not really, I’ve been called up for reserve service :/

Get Outlook for iOShttps://aka.ms/o0ukef


From: ronengr @.> Sent: Tuesday, October 17, 2023 10:19:23 PM To: ronengr/hass_nuki_bt @.> Cc: pelegw @.>; Author @.> Subject: Re: [ronengr/hass_nuki_bt] No Entities on Nuki (Issue #17)

I have released a new version that should fix this issue. can you please check?

— Reply to this email directly, view it on GitHubhttps://github.com/ronengr/hass_nuki_bt/issues/17#issuecomment-1767020833, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABP6WAB76UQBL5EL3WOHMGLX73K3XAVCNFSM6AAAAAA5EQKH4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRXGAZDAOBTGM. You are receiving this because you authored the thread.Message ID: @.***>

ronengr commented 8 months ago

@pelegw keep safe

melegio commented 5 months ago

I have the same error. How can I solve it?

2024-01-11 22:00:48.294 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hass_nuki_bt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-11 22:00:48.294 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration netro_watering which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-11 22:00:48.294 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-11 22:00:48.295 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration webrtc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-11 22:00:48.295 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration eufy_security which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-11 22:00:52.358 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.hacs.update.HacsRepositoryUpdateEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <UpdateEntityFeature.INSTALL|PROGRESS|RELEASE_NOTES: 21>, please create a bug report at https://github.com/hacs/integration/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation 2024-01-11 22:00:52.358 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.hacs.update.HacsRepositoryUpdateEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <UpdateEntityFeature.INSTALL|PROGRESS|RELEASE_NOTES: 21>, please create a bug report at https://github.com/hacs/integration/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation 2024-01-11 22:00:52.359 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.hacs.update.HacsRepositoryUpdateEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <UpdateEntityFeature.INSTALL|PROGRESS|RELEASE_NOTES: 21>, please create a bug report at https://github.com/hacs/integration/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation 2024-01-11 22:00:52.359 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.hacs.update.HacsRepositoryUpdateEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <UpdateEntityFeature.INSTALL|PROGRESS|RELEASE_NOTES: 21>, please create a bug report at https://github.com/hacs/integration/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation 2024-01-11 22:00:52.360 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.hacs.update.HacsRepositoryUpdateEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <UpdateEntityFeature.INSTALL|PROGRESS|RELEASE_NOTES: 21>, please create a bug report at https://github.com/hacs/integration/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation 2024-01-11 22:00:54.953 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Nuki_21BBF85D for hass_nuki_bt Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hass_nuki_bt/init.py", line 86, in async_setup_entry if not await coordinator.async_wait_ready(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hass_nuki_bt/coordinator.py", line 151, in async_wait_ready await self._async_update() File "/config/custom_components/hass_nuki_bt/coordinator.py", line 110, in _async_update await self.device.update_state() File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 420, in update_state await self.connect() # connect so we can identify the device type and update self._const accordingly ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 384, in connect logger.debug(f"Services {[str(s) for s in self._client.services]}") ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bleak/init.py", line 686, in services if not self._backend.services: ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'services' 2024-01-11 22:01:02.570 ERROR (MainThread) [homeassistant] 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 268, in _notification_handler msg = self._parse_message(bytes(data), encrypted) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 202, 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 2024-01-11 22:01:22.567 ERROR (MainThread) [custom_components.hass_nuki_bt] 54:D2:72:BB:F8:5D: Failure while polling Traceback (most recent call last): File "/usr/local/lib/python3.11/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/components/bluetooth/active_update_coordinator.py", line 129, in _async_poll self.data = await self._async_poll_data(self._last_service_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_coordinator.py", line 122, in _async_poll_data return await self._poll_method(last_service_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hass_nuki_bt/coordinator.py", line 110, in _async_update await self.device.update_state() File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 421, in update_state msg = await self._send_encrtypted_command( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 189, in _send_encrtypted_command return await self._send_command( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 361, in _send_command async with async_timeout.timeout(self.command_response_timeout): File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 141, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 228, in _do_exit raise asyncio.TimeoutError TimeoutError 2024-01-11 22:01:52.851 ERROR (MainThread) [homeassistant] 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 268, in _notification_handler msg = self._parse_message(bytes(data), encrypted) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyNukiBT/nuki.py", line 202, 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

fabermundi commented 4 months ago

Hello,

Unfortunately I also have to same error. It seems that a function signature has change (number of parameters).

ronengr commented 2 months ago

@fabermundi @melegio can you please check if it still happens in latest version? I've did some changes in the code that might fix this issue.

melegio commented 2 months ago

Sorry, The issue is still there. On 5 Apr 2024, at 11:23 PM, ronengr @.***> wrote: @fabermundi @melegio can you please check if it still happens in latest version? I've did some changes in the code that might fix this issue.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

ronengr commented 2 months ago

@melegio are you getting the same error? how far is the lock from your BT device?

from the looks of the last logs you attached it seems like a connection issue - try putting the BT closer to the lock.

fabermundi commented 2 months ago

@fabermundi @melegio can you please check if it still happens in latest version? I've did some changes in the code that might fix this issue.

@ronengr Hello, Unfortunately I also got the same error. My Home Assistant is running on a Raspberry PI so I put it like 1 metre away on the Nuki and still got the error. I was trying the "App" mode of the integration.

fabermundi commented 2 months ago

In addition to the before mentioned exception I also get:

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/hass_nuki_bt/button.py", line 46, in async_setup_entry async_add_entities([NukiButton(coordinator, btn) for btn in BUTTON_TYPES]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hass_nuki_bt/button.py", line 58, in init super().init(coordinator) File "/config/custom_components/hass_nuki_bt/entity.py", line 42, in init str(x) for x in coordinator.device.config["hardware_revision"]


KeyError: 'hardware_revision'

For the entities "button", "sensor", "lock" and "binary_sensor".

An the exception

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 366, 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/components/bluetooth/active_update_coordinator.py", line 131, in _async_poll
    self.data = await self._async_poll_data(self._last_service_info)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_coordinator.py", line 124, in _async_poll_data
    return await self._poll_method(last_service_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hass_nuki_bt/coordinator.py", line 110, in _async_update
    await self.device.update_state()
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 428, in update_state
    msg = await self._send_encrtypted_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 193, in _send_encrtypted_command
    return await self._send_command(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 365, 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

Very strange, that I get a TimeoutError because as mentioned the Raspberry is just next to the Nuki.
melegio commented 2 months ago

My BT is 2mt far from the nuki. This is the error that I get. Logger: homeassistant Source: /usr/src/homeassistant/homeassistant/runner.py:146 First occurred: April 9, 2024 at 6:19:28 PM (5262 occurrences) Last logged: 7:10:50 PM

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 272, in _notification_handler msg = self._parse_message(bytes(data), encrypted) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyNukiBT/nuki.py", line 206, in _parse_message msg = self._const.NukiMessage.parse(self._decrypt_message(data)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 288, in parse return self.parse_stream(io.BytesIO(data), **contextkw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 300, in parse_stream return self._parsereport(stream, context, "(parsing)") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 2120, in _parse subobj = sc._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 2653, in _parse return self.subcon._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyNukiBT/const.py", line 948, in _parse hash1 = self.checksumfield._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 1041, in _parse data = stream_read(stream, self.length, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/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

ronengr commented 2 months ago

@fabermundi these are strange error you are getting about the hardware_revision can you give me some more debug logs? it's hard to say from the error why there is no hardware revision in the config. there should be a debug print of the driver getting the config info from the lock, I'm interested to see if the hw revision is just missing there or what the issue is.

for now, you can add a small patch locally to avoid an exception in this case, but i would prefer finding the root-cause and not just ignoring the isue.


diff --git a/custom_components/hass_nuki_bt/entity.py b/custom_components/hass_nuki_bt/entity.py
index 601b173..7c40ade 100644
--- a/custom_components/hass_nuki_bt/entity.py
+++ b/custom_components/hass_nuki_bt/entity.py
@@ -39,10 +39,10 @@ class NukiEntity(PassiveBluetoothCoordinatorEntity[NukiDataUpdateCoordinator]):
             model=coordinator.device.device_type,
             name=coordinator.device_name,
             hw_version=".".join(
-                str(x) for x in coordinator.device.config["hardware_revision"]
+                str(x) for x in coordinator.device.config.get("hardware_revision",[])
             ),
             sw_version=".".join(
-                str(x) for x in coordinator.device.config["firmware_version"]
+                str(x) for x in coordinator.device.config.get("firmware_version",[])
             ),
         )
ronengr commented 2 months ago

@melegio without context it is hard to debug. can you add the full debug log so i know in what exact flow the error occurred?

Terabyte2000 commented 2 months ago

@ronengr

I get the same error with hardware_revision

What do you need to find the failure?

And how can I add your patch you posted before?

Thx

ronengr commented 2 months ago

@melegio @fabermundi can you try with latest version? Seems the config msg is formatted differently in nuki 4, so i've added ability to ignore config if it is not needed.

melegio commented 2 months ago

Now it works!!!Thank youGiovanniOn 21 Apr 2024, at 9:23 PM, ronengr @.***> wrote: @melegio @fabermundi can you try with latest version? Seems the config msg is formatted differently in nuki 4, so i've added ability to ignore config if it is not needed.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>