Await startup in homekit controller (#75021)
This commit is contained in:
parent
a3c1926da5
commit
a31dde9cb4
7 changed files with 133 additions and 30 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue