home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.42k stars 30.3k forks source link

Can't Provision Thread Credentials - Unknown TLV type 74 for <class 'aiohomekit.meshcop.Meshcop'> #127601

Open laurentfignon opened 1 week ago

laurentfignon commented 1 week ago

The problem

I'm adding Smartwings Cellular Shades (HomeKit Thread enabled) to Home Assistant. Adding HomeKit device works correctly via ESP BLE, but when I attempt to provision thread credentials, I always get the error: "Failed to perform the action button/press. Unknown TLV type 74 for <class 'aiohomekit.meshcop.Meshcop'>"

My thread network includes an AppleTV, HomePod mini, and OTBR with SkyConnect. The Preferred Network seems to be working correctly, and the HomeKit iOS app seems to correctly pass credentials to HA and the phone. However, logs do show the following warning and error:

FIRST -- when I send credentials to HA I get this WARNING:

Logger: homeassistant.components.thread.dataset_store Source: components/thread/dataset_store.py:263 integration: Thread (documentation, issues) First occurred: 12:46:14 PM (12 occurrences) Last logged: 1:06:02 PM

Got dataset with same extended PAN ID and same or older active timestamp, old dataset: '0e08000066b7ddca000000030000194a0300001435060004001fffc002088f09c7a782bc40b40708fdca2d9b7143294e0510cde974831a4174b49be214ecff39b40b030f4d79486f6d65383233353639343136010289b00410daceb4ad74e566628d678effa29f01d50c0402a0f7f8', new dataset: '0e08000066b7ddca0000000300001935060004001fffc002088f09c7a782bc40b40708fdca2d9b7143294e0510cde974831a4174b49be214ecff39b40b030f4d79486f6d65383233353639343136010289b00410daceb4ad74e566628d678effa29f01d50c0402a0f7f8'

SECOND -- when I attempt to provision the thread credentials to the device, I get this:

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:245 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:47:59 PM (8 occurrences) Last logged: 1:06:43 PM

[139732691690272] Unexpected exception [139732573169856] Unexpected exception [139732650753136] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 132, in _async_press_action await self.async_press() File "/usr/src/homeassistant/homeassistant/components/homekit_controller/button.py", line 190, in async_press await self._accessory.async_thread_provision() File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 1032, in async_thread_provision await self.pairing.thread_provision(dataset) File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 197, in _async_operation_lock_wrap return await func(self, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/init.py", line 505, in _async_wrap_bluetooth_connection_error_retry return await func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 236, in _async_force_fresh_connection return await func(self, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 213, in _async_restore_and_resume return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 1557, in thread_provision decoded = Meshcop.decode(bytes.fromhex(dataset)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/tlv8.py", line 299, in decode raise TlvParseException(f"Unknown TLV type {type} for {cls}") aiohomekit.tlv8.TlvParseException: Unknown TLV type 74 for <class 'aiohomekit.meshcop.Meshcop'>

Can anyone help?

What version of Home Assistant Core has the issue?

core-2024.10.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Thread

Link to integration documentation on our website

No response

Diagnostics information

home-assistant_thread_2024-10-04T20-19-22.816Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

chaudis commented 2 days ago

I get the same error when I try to provision an Eve Homekit device to Thread.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 22:06:23 (3 occurrences)
Last logged: 22:07:01
[547348893408] Unexpected exception

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 132, in _async_press_action
    await self.async_press()
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/button.py", line 190, in async_press
    await self._accessory.async_thread_provision()
  File "/usr/src/homeassistant/homeassistant/components/homekit_controller/connection.py", line 1032, in async_thread_provision
    await self.pairing.thread_provision(dataset)
  File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 197, in _async_operation_lock_wrap
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/__init__.py", line 505, in _async_wrap_bluetooth_connection_error_retry
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 236, in _async_force_fresh_connection
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 213, in _async_restore_and_resume
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ble/pairing.py", line 1557, in thread_provision
    decoded = Meshcop.decode(bytes.fromhex(dataset))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohomekit/tlv8.py", line 299, in decode
    raise TlvParseException(f"Unknown TLV type {type} for {cls}")
aiohomekit.tlv8.TlvParseException: Unknown TLV type 74 for <class 'aiohomekit.meshcop.Meshcop'>

What version of Home Assistant Core has the issue?

Core 2024.10.0

What type of installation are you running?

Docker

Integration causing the issue

Thread

Android 2024.9.4

chaudis commented 14 hours ago

Same in 2å24.10.2