Pass in the bleak scanner instance to HKC (#75636)

This commit is contained in:
J. Nick Koston
2022-07-23 02:47:02 -05:00
committed by GitHub
parent 8e86124470
commit edaebcd85d
5 changed files with 16 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ from typing import cast
from aiohomekit import Controller
from homeassistant.components import zeroconf
from homeassistant.components import bluetooth, zeroconf
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Event, HomeAssistant
@@ -28,7 +28,12 @@ async def async_get_controller(hass: HomeAssistant) -> Controller:
if existing := hass.data.get(CONTROLLER):
return cast(Controller, existing)
controller = Controller(async_zeroconf_instance=async_zeroconf_instance)
bleak_scanner_instance = bluetooth.async_get_scanner(hass)
controller = Controller(
async_zeroconf_instance=async_zeroconf_instance,
bleak_scanner_instance=bleak_scanner_instance,
)
hass.data[CONTROLLER] = controller