mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
HomeKit Controller BLE Fixes (#75271)
This commit is contained in:
parent
c6c063e8c5
commit
97fd669924
@ -6,6 +6,7 @@ import re
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import aiohomekit
|
import aiohomekit
|
||||||
|
from aiohomekit.controller.abstract import AbstractPairing
|
||||||
from aiohomekit.exceptions import AuthenticationError
|
from aiohomekit.exceptions import AuthenticationError
|
||||||
from aiohomekit.model import Accessories, CharacteristicsTypes, ServicesTypes
|
from aiohomekit.model import Accessories, CharacteristicsTypes, ServicesTypes
|
||||||
from aiohomekit.utils import domain_supported, domain_to_name
|
from aiohomekit.utils import domain_supported, domain_to_name
|
||||||
@ -468,13 +469,13 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
data_schema=vol.Schema(schema),
|
data_schema=vol.Schema(schema),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _entry_from_accessory(self, pairing):
|
async def _entry_from_accessory(self, pairing: AbstractPairing) -> FlowResult:
|
||||||
"""Return a config entry from an initialized bridge."""
|
"""Return a config entry from an initialized bridge."""
|
||||||
# The bulk of the pairing record is stored on the config entry.
|
# The bulk of the pairing record is stored on the config entry.
|
||||||
# A specific exception is the 'accessories' key. This is more
|
# A specific exception is the 'accessories' key. This is more
|
||||||
# volatile. We do cache it, but not against the config entry.
|
# volatile. We do cache it, but not against the config entry.
|
||||||
# So copy the pairing data and mutate the copy.
|
# So copy the pairing data and mutate the copy.
|
||||||
pairing_data = pairing.pairing_data.copy()
|
pairing_data = pairing.pairing_data.copy() # type: ignore[attr-defined]
|
||||||
|
|
||||||
# Use the accessories data from the pairing operation if it is
|
# Use the accessories data from the pairing operation if it is
|
||||||
# available. Otherwise request a fresh copy from the API.
|
# available. Otherwise request a fresh copy from the API.
|
||||||
@ -489,6 +490,8 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
name = accessory_info.value(CharacteristicsTypes.NAME, "")
|
name = accessory_info.value(CharacteristicsTypes.NAME, "")
|
||||||
|
|
||||||
|
await pairing.close()
|
||||||
|
|
||||||
return self.async_create_entry(title=name, data=pairing_data)
|
return self.async_create_entry(title=name, data=pairing_data)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user