mirror of
https://github.com/home-assistant/core.git
synced 2025-10-16 07:09:27 +00:00
Dont rely on config flow to monitor homekit_controller c# changes (#76861)
This commit is contained in:
@@ -8,6 +8,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant
|
||||
|
||||
from .const import CONTROLLER
|
||||
from .storage import async_get_entity_storage
|
||||
|
||||
|
||||
def folded_name(name: str) -> str:
|
||||
@@ -22,6 +23,8 @@ async def async_get_controller(hass: HomeAssistant) -> Controller:
|
||||
|
||||
async_zeroconf_instance = await zeroconf.async_get_async_instance(hass)
|
||||
|
||||
char_cache = await async_get_entity_storage(hass)
|
||||
|
||||
# In theory another call to async_get_controller could have run while we were
|
||||
# trying to get the zeroconf instance. So we check again to make sure we
|
||||
# don't leak a Controller instance here.
|
||||
@@ -33,6 +36,7 @@ async def async_get_controller(hass: HomeAssistant) -> Controller:
|
||||
controller = Controller(
|
||||
async_zeroconf_instance=async_zeroconf_instance,
|
||||
bleak_scanner_instance=bleak_scanner_instance, # type: ignore[arg-type]
|
||||
char_cache=char_cache,
|
||||
)
|
||||
|
||||
hass.data[CONTROLLER] = controller
|
||||
|
Reference in New Issue
Block a user