mirror of
https://github.com/home-assistant/core.git
synced 2025-11-17 23:10:28 +00:00
Await startup in homekit controller (#75021)
This commit is contained in:
@@ -17,6 +17,7 @@ from homeassistant.core import callback
|
||||
from homeassistant.data_entry_flow import AbortFlow, FlowResult
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .connection import HKDevice
|
||||
from .const import DOMAIN, KNOWN_DEVICES
|
||||
from .utils import async_get_controller
|
||||
|
||||
@@ -240,17 +241,19 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
self.hass.config_entries.async_update_entry(
|
||||
existing_entry, data={**existing_entry.data, **updated_ip_port}
|
||||
)
|
||||
conn = self.hass.data[KNOWN_DEVICES][hkid]
|
||||
conn: HKDevice = self.hass.data[KNOWN_DEVICES][hkid]
|
||||
# When we rediscover the device, let aiohomekit know
|
||||
# that the device is available and we should not wait
|
||||
# to retry connecting any longer. reconnect_soon
|
||||
# will do nothing if the device is already connected
|
||||
await conn.pairing.reconnect_soon()
|
||||
if conn.config_num != config_num:
|
||||
if config_num and conn.config_num != config_num:
|
||||
_LOGGER.debug(
|
||||
"HomeKit info %s: c# incremented, refreshing entities", hkid
|
||||
)
|
||||
self.hass.async_create_task(conn.async_refresh_entity_map(config_num))
|
||||
self.hass.async_create_task(
|
||||
conn.async_refresh_entity_map_and_entities(config_num)
|
||||
)
|
||||
return self.async_abort(reason="already_configured")
|
||||
|
||||
_LOGGER.debug("Discovered device %s (%s - %s)", name, model, hkid)
|
||||
|
||||
Reference in New Issue
Block a user