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
69.71k stars 28.87k forks source link

Some HomeKit Bridges duplicate devices and entities #120259

Open TibocaDenis opened 1 week ago

TibocaDenis commented 1 week ago

The problem

Any restart of home assistant or updating a Homekit bridge (I split every integration into a bridge to check which ones do this often) creates duplicates for each device/entity. Setup done with UI.

I tried deleting the connection to the bridge from HomeKit Device, then deleting the bridge from HomeKit Bridge, creating it, and adding it again. This is a temporary solution, and it will start doing it again. Is there something I am missing? The most frequent integrations that are creating duplicates are: Binary Sensor, Camera, Climate, Fan, Humidifier, Light and Sensor. It doesn't seem generic as it only affects those, the other integrations are not affected, always having the same number of devices/entities (no duplicates created). I tried deleting the new ones also, but HomeAssistant doesn't react to the command. I even tried to change (in HomeKit Bridge) the configuration the exclude the duplicates and update the bridges, but with no luck.

Running HomeAssistant with Virtual Box on a laptop, this issue is present for a couple of weeks since I started to play a bit with Home Assistant (2024.5.3 - 2024.5.5, don't remember the exact version). Now I'm currently on 2024.6.3. example of duplicates - Copy

What version of Home Assistant Core has the issue?

core-2024.6.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

HomeKit Bridge/Integration

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-06-23 21:10:17.623 ERROR (MainThread) [pyhap.hap_handler] HASS Bridge FK: Client (x) with uuid 8e25b4cf-5510-42c3-bb5c-8f0ce134eca4 attempted pair verify without being paired first (public_key=9f23bd93478faae75e2bb7874d6b7ba4f343b5d8dca5dfdff6103f09e108d85a, paired clients={UUID('c6f99506-3b8b-4ad0-a244-f7187d08dd52'): '78df08ee8d529f142b17d6e258441840f48e66f9369419794b129144b3690d57'}). 2024-06-23 21:10:17.630 ERROR (MainThread) [aiohomekit.utils] Failure running background task: Task-8623 Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohomekit/utils.py", line 40, in _handle_task_result task.result() File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ip/connection.py", line 639, in _reconnect return await self._connect_once() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/controller/ip/connection.py", line 747, in _connect_once request, expected = state_machine.send(response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohomekit/protocol/init.py", line 596, in get_session_keys handle_state_step(response_tlv, TLV.M4) File "/usr/local/lib/python3.12/site-packages/aiohomekit/protocol/init.py", line 90, in handle_state_step error_handler(tlv_dict[TLV.kTLVType_Error], f"step {expected_state}") File "/usr/local/lib/python3.12/site-packages/aiohomekit/protocol/init.py", line 64, in error_handler raise AuthenticationError(stage) aiohomekit.exceptions.AuthenticationError: step bytearray(b'\x04') 2024-06-23 21:11:21.175 ERROR (MainThread) [pyhap.hap_handler] HASS Bridge FK: Client (x) with uuid 3b9ad791-d055-4df6-9da1-2f8c19f39731 attempted pair verify without being paired first (public_key=779581fe2dfc938f7e8715f6660caad1de7bc01df90607509cc78b08455d5509, paired clients={UUID('c6f99506-3b8b-4ad0-a244-f7187d08dd52'): '78df08ee8d529f142b17d6e258441840f48e66f9369419794b129144b3690d57'}). 2024-06-23 21:11:21.176 ERROR (MainThread) [pyhap.hap_handler] HASS Bridge FK: Client (x) with uuid 8e25b4cf-5510-42c3-bb5c-8f0ce134eca4 attempted pair verify without being paired first (public_key=a3e750c1ee5dc37fe04b0914384a2ff93fdd16ba83cc4d6d5e0443ce1c3be773, paired clients={UUID('c6f99506-3b8b-4ad0-a244-f7187d08dd52'): '78df08ee8d529f142b17d6e258441840f48e66f9369419794b129144b3690d57'}).

Note: hidden ip with x

Additional information

No response

home-assistant[bot] commented 1 week ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `homekit` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homekit` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homekit documentation homekit source (message by IssueLinks)

wgshef commented 4 days ago

I'm also having this problem. Running Core on a stand-alone PC. Core 2024.6.4 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240610.1

Fairly new Home Assistant user, just starting to work with getting things down to my Apple Devices.

TibocaDenis commented 4 days ago

I'm not using Apple devices, in my case I'm using HomeKit as a digital hub for different devices. Not sure how exactly works but at least I can connect my devices even if I'm on Android.

Without any update and a lot of restarts of HA, now I don't always need to delete the bridge itself from bridges section. It is enough to go to HomeKit devices, remove the bridge there go back to Bridges, configure it again then add it again. Previously it worked only by deleting both and starting again.

I'm also new, running on VM on a laptop. Working my way around simple automations for now.

Edit*: sorry for accidentally closing it, not used to comment from the phone