Add names to homekit tasks to better track startup problems (#90802)
* Add names to homekit tasks to better track startup problems * fix testpull/91079/head^2
parent
3be3226aaa
commit
d442f2aedb
|
@ -597,7 +597,9 @@ class HomeKit:
|
|||
await self._async_shutdown_accessory(acc)
|
||||
if new_acc := self._async_create_single_accessory([state]):
|
||||
self.driver.accessory = new_acc
|
||||
self.hass.async_add_job(new_acc.run)
|
||||
self.hass.async_create_task(
|
||||
new_acc.run(), f"HomeKit Bridge Accessory: {new_acc.entity_id}"
|
||||
)
|
||||
await self.async_config_changed()
|
||||
|
||||
async def async_reset_accessories_in_bridge_mode(
|
||||
|
@ -637,7 +639,9 @@ class HomeKit:
|
|||
await asyncio.sleep(_HOMEKIT_CONFIG_UPDATE_TIME)
|
||||
for state in new:
|
||||
if acc := self.add_bridge_accessory(state):
|
||||
self.hass.async_add_job(acc.run)
|
||||
self.hass.async_create_task(
|
||||
acc.run(), f"HomeKit Bridge Accessory: {acc.entity_id}"
|
||||
)
|
||||
await self.async_config_changed()
|
||||
|
||||
async def async_config_changed(self) -> None:
|
||||
|
|
|
@ -815,14 +815,10 @@ async def test_homekit_reset_accessories(
|
|||
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
|
||||
|
||||
with patch(f"{PATH_HOMEKIT}.HomeKit", return_value=homekit), patch(
|
||||
"pyhap.accessory.Bridge.add_accessory"
|
||||
) as mock_add_accessory, patch(
|
||||
"pyhap.accessory_driver.AccessoryDriver.config_changed"
|
||||
), patch(
|
||||
"pyhap.accessory_driver.AccessoryDriver.async_start"
|
||||
), patch(
|
||||
), patch("pyhap.accessory_driver.AccessoryDriver.async_start"), patch(
|
||||
f"{PATH_HOMEKIT}.accessories.HomeAccessory.run"
|
||||
), patch.object(
|
||||
) as mock_run_accessory, patch.object(
|
||||
homekit_base, "_HOMEKIT_CONFIG_UPDATE_TIME", 0
|
||||
):
|
||||
await async_init_entry(hass, entry)
|
||||
|
@ -837,8 +833,9 @@ async def test_homekit_reset_accessories(
|
|||
blocking=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_add_accessory.called
|
||||
assert mock_run_accessory.called
|
||||
homekit.status = STATUS_READY
|
||||
await homekit.async_stop()
|
||||
|
||||
|
|
Loading…
Reference in New Issue