Remove safe mode from HomeKit (#45028)

Safe mode was added to work around a race condition where
the mdns announcment was sent too early and would cause
pairing to fail. Since this has been corrected in
HAP-python, there is no longer a need to have
safe mode.
This commit is contained in:
J. Nick Koston 2021-01-11 03:26:09 -10:00 committed by GitHub
parent e584902b8b
commit af21893652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 194 deletions

View file

@ -114,6 +114,7 @@ def _has_all_unique_names_and_ports(bridges):
BRIDGE_SCHEMA = vol.All(
cv.deprecated(CONF_ZEROCONF_DEFAULT_INTERFACE),
cv.deprecated(CONF_SAFE_MODE),
vol.Schema(
{
vol.Optional(CONF_HOMEKIT_MODE, default=DEFAULT_HOMEKIT_MODE): vol.In(
@ -246,7 +247,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
homekit_mode = options.get(CONF_HOMEKIT_MODE, DEFAULT_HOMEKIT_MODE)
entity_config = options.get(CONF_ENTITY_CONFIG, {}).copy()
auto_start = options.get(CONF_AUTO_START, DEFAULT_AUTO_START)
safe_mode = options.get(CONF_SAFE_MODE, DEFAULT_SAFE_MODE)
entity_filter = FILTER_SCHEMA(options.get(CONF_FILTER, {}))
homekit = HomeKit(
@ -256,7 +256,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
ip_address,
entity_filter,
entity_config,
safe_mode,
homekit_mode,
advertise_ip,
entry.entry_id,
@ -421,7 +420,6 @@ class HomeKit:
ip_address,
entity_filter,
entity_config,
safe_mode,
homekit_mode,
advertise_ip=None,
entry_id=None,
@ -433,7 +431,6 @@ class HomeKit:
self._ip_address = ip_address
self._filter = entity_filter
self._config = entity_config
self._safe_mode = safe_mode
self._advertise_ip = advertise_ip
self._entry_id = entry_id
self._homekit_mode = homekit_mode
@ -470,10 +467,6 @@ class HomeKit:
else:
self.driver.persist()
if self._safe_mode:
_LOGGER.debug("Safe_mode selected for %s", self._name)
self.driver.safe_mode = True
def reset_accessories(self, entity_ids):
"""Reset the accessory to load the latest configuration."""
if not self.bridge:

View file

@ -21,12 +21,10 @@ from .const import (
CONF_ENTITY_CONFIG,
CONF_FILTER,
CONF_HOMEKIT_MODE,
CONF_SAFE_MODE,
CONF_VIDEO_CODEC,
DEFAULT_AUTO_START,
DEFAULT_CONFIG_FLOW_PORT,
DEFAULT_HOMEKIT_MODE,
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_ACCESSORY,
HOMEKIT_MODES,
SHORT_BRIDGE_NAME,
@ -217,40 +215,32 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
async def async_step_advanced(self, user_input=None):
"""Choose advanced options."""
if user_input is not None:
self.homekit_options.update(user_input)
for key in (CONF_DOMAINS, CONF_ENTITIES):
if key in self.homekit_options:
del self.homekit_options[key]
return self.async_create_entry(title="", data=self.homekit_options)
if not self.show_advanced_options or user_input is not None:
if user_input:
self.homekit_options.update(user_input)
schema_base = {}
if self.show_advanced_options:
schema_base[
vol.Optional(
CONF_AUTO_START,
default=self.homekit_options.get(
CONF_AUTO_START, DEFAULT_AUTO_START
),
)
] = bool
else:
self.homekit_options[CONF_AUTO_START] = self.homekit_options.get(
CONF_AUTO_START, DEFAULT_AUTO_START
)
schema_base.update(
{
vol.Optional(
CONF_SAFE_MODE,
default=self.homekit_options.get(CONF_SAFE_MODE, DEFAULT_SAFE_MODE),
): bool
}
)
for key in (CONF_DOMAINS, CONF_ENTITIES):
if key in self.homekit_options:
del self.homekit_options[key]
return self.async_create_entry(title="", data=self.homekit_options)
return self.async_show_form(
step_id="advanced", data_schema=vol.Schema(schema_base)
step_id="advanced",
data_schema=vol.Schema(
{
vol.Optional(
CONF_AUTO_START,
default=self.homekit_options.get(
CONF_AUTO_START, DEFAULT_AUTO_START
),
): bool
}
),
)
async def async_step_cameras(self, user_input=None):

View file

@ -30,8 +30,7 @@
},
"advanced": {
"data": {
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)",
"safe_mode": "Safe Mode (enable only if pairing fails)"
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)"
},
"description": "These settings only need to be adjusted if HomeKit is not functional.",
"title": "Advanced Configuration"

View file

@ -30,8 +30,7 @@
},
"advanced": {
"data": {
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)",
"safe_mode": "Safe Mode (enable only if pairing fails)"
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)"
},
"description": "These settings only need to be adjusted if HomeKit is not functional.",
"title": "Advanced Configuration"

View file

@ -28,7 +28,6 @@ def _mock_config_entry_with_options_populated():
],
"exclude_entities": ["climate.front_gate"],
},
"safe_mode": False,
},
)
@ -159,7 +158,7 @@ async def test_options_flow_exclude_mode_advanced(auto_start, hass):
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"auto_start": auto_start, "safe_mode": True},
user_input={"auto_start": auto_start},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
@ -172,7 +171,6 @@ async def test_options_flow_exclude_mode_advanced(auto_start, hass):
"include_domains": ["fan", "vacuum", "climate", "humidifier"],
"include_entities": [],
},
"safe_mode": True,
}
@ -204,16 +202,7 @@ async def test_options_flow_exclude_mode_basic(hass):
result["flow_id"],
user_input={"entities": ["climate.old"], "include_exclude_mode": "exclude"},
)
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result2["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"safe_mode": True},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -223,7 +212,6 @@ async def test_options_flow_exclude_mode_basic(hass):
"include_domains": ["fan", "vacuum", "climate"],
"include_entities": [],
},
"safe_mode": True,
}
@ -257,16 +245,7 @@ async def test_options_flow_include_mode_basic(hass):
result["flow_id"],
user_input={"entities": ["climate.new"], "include_exclude_mode": "include"},
)
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result2["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"safe_mode": True},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -276,7 +255,6 @@ async def test_options_flow_include_mode_basic(hass):
"include_domains": ["fan", "vacuum"],
"include_entities": ["climate.new"],
},
"safe_mode": True,
}
@ -323,16 +301,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass):
user_input={"camera_copy": ["camera.native_h264"]},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result3["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result4 = await hass.config_entries.options.async_configure(
result3["flow_id"],
user_input={"safe_mode": True},
)
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -343,7 +312,6 @@ async def test_options_flow_exclude_mode_with_cameras(hass):
"include_entities": [],
},
"entity_config": {"camera.native_h264": {"video_codec": "copy"}},
"safe_mode": True,
}
# Now run though again and verify we can turn off copy
@ -378,16 +346,7 @@ async def test_options_flow_exclude_mode_with_cameras(hass):
user_input={"camera_copy": []},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result3["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result4 = await hass.config_entries.options.async_configure(
result3["flow_id"],
user_input={"safe_mode": True},
)
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -398,7 +357,6 @@ async def test_options_flow_exclude_mode_with_cameras(hass):
"include_entities": [],
},
"entity_config": {"camera.native_h264": {}},
"safe_mode": True,
}
@ -445,16 +403,7 @@ async def test_options_flow_include_mode_with_cameras(hass):
user_input={"camera_copy": ["camera.native_h264"]},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result3["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result4 = await hass.config_entries.options.async_configure(
result3["flow_id"],
user_input={"safe_mode": True},
)
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -465,7 +414,6 @@ async def test_options_flow_include_mode_with_cameras(hass):
"include_entities": ["camera.native_h264", "camera.transcode_h264"],
},
"entity_config": {"camera.native_h264": {"video_codec": "copy"}},
"safe_mode": True,
}
# Now run though again and verify we can turn off copy
@ -500,16 +448,7 @@ async def test_options_flow_include_mode_with_cameras(hass):
user_input={"camera_copy": []},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result3["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result4 = await hass.config_entries.options.async_configure(
result3["flow_id"],
user_input={"safe_mode": True},
)
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
@ -520,7 +459,6 @@ async def test_options_flow_include_mode_with_cameras(hass):
"include_entities": [],
},
"entity_config": {"camera.native_h264": {}},
"safe_mode": True,
}
@ -543,7 +481,6 @@ async def test_options_flow_blocked_when_from_yaml(hass):
],
"exclude_entities": ["climate.front_gate"],
},
"safe_mode": False,
},
source=SOURCE_IMPORT,
)
@ -594,16 +531,7 @@ async def test_options_flow_include_mode_basic_accessory(hass):
result["flow_id"],
user_input={"entities": "media_player.tv"},
)
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result2["step_id"] == "advanced"
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"safe_mode": False},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "accessory",
@ -613,5 +541,4 @@ async def test_options_flow_include_mode_basic_accessory(hass):
"include_domains": [],
"include_entities": ["media_player.tv"],
},
"safe_mode": False,
}

View file

@ -28,9 +28,7 @@ from homeassistant.components.homekit.const import (
BRIDGE_SERIAL_NUMBER,
CONF_AUTO_START,
CONF_ENTRY_INDEX,
CONF_SAFE_MODE,
DEFAULT_PORT,
DEFAULT_SAFE_MODE,
DOMAIN,
HOMEKIT,
HOMEKIT_FILE,
@ -99,7 +97,7 @@ def debounce_patcher_fixture():
patcher.stop()
async def test_setup_min(hass):
async def test_setup_min(hass, mock_zeroconf):
"""Test async_setup with min config options."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -121,7 +119,6 @@ async def test_setup_min(hass):
None,
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -136,12 +133,12 @@ async def test_setup_min(hass):
mock_homekit().async_start.assert_called()
async def test_setup_auto_start_disabled(hass):
async def test_setup_auto_start_disabled(hass, mock_zeroconf):
"""Test async_setup with auto start disabled and test service calls."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "Test Name", CONF_PORT: 11111, CONF_IP_ADDRESS: "172.0.0.0"},
options={CONF_AUTO_START: False, CONF_SAFE_MODE: DEFAULT_SAFE_MODE},
options={CONF_AUTO_START: False},
)
entry.add_to_hass(hass)
@ -158,7 +155,6 @@ async def test_setup_auto_start_disabled(hass):
"172.0.0.0",
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -191,7 +187,7 @@ async def test_setup_auto_start_disabled(hass):
assert homekit.async_start.called is False
async def test_homekit_setup(hass, hk_driver):
async def test_homekit_setup(hass, hk_driver, mock_zeroconf):
"""Test setup of bridge and driver."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -205,7 +201,6 @@ async def test_homekit_setup(hass, hk_driver):
None,
{},
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -238,7 +233,7 @@ async def test_homekit_setup(hass, hk_driver):
assert hass.bus.async_listeners().get(EVENT_HOMEASSISTANT_STOP) == 1
async def test_homekit_setup_ip_address(hass, hk_driver):
async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
"""Test setup with given IP address."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -252,7 +247,6 @@ async def test_homekit_setup_ip_address(hass, hk_driver):
"172.0.0.0",
{},
{},
None,
HOMEKIT_MODE_BRIDGE,
None,
entry_id=entry.entry_id,
@ -277,7 +271,7 @@ async def test_homekit_setup_ip_address(hass, hk_driver):
)
async def test_homekit_setup_advertise_ip(hass, hk_driver):
async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
"""Test setup with given IP address to advertise."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -291,7 +285,6 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver):
"0.0.0.0",
{},
{},
None,
HOMEKIT_MODE_BRIDGE,
"192.168.1.100",
entry_id=entry.entry_id,
@ -316,31 +309,6 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver):
)
async def test_homekit_setup_safe_mode(hass, hk_driver):
"""Test if safe_mode flag is set."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
source=SOURCE_IMPORT,
)
homekit = HomeKit(
hass,
BRIDGE_NAME,
DEFAULT_PORT,
None,
{},
{},
True,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
)
with patch(f"{PATH_HOMEKIT}.accessories.HomeDriver", return_value=hk_driver):
await hass.async_add_executor_job(homekit.setup, MagicMock())
assert homekit.driver.safe_mode is True
async def test_homekit_add_accessory(hass, mock_zeroconf):
"""Add accessory if config exists and get_acc returns an accessory."""
entry = await async_init_integration(hass)
@ -352,7 +320,6 @@ async def test_homekit_add_accessory(hass, mock_zeroconf):
None,
lambda entity_id: True,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -394,7 +361,6 @@ async def test_homekit_warn_add_accessory_bridge(
None,
lambda entity_id: True,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -431,7 +397,6 @@ async def test_homekit_remove_accessory(hass, mock_zeroconf):
None,
lambda entity_id: True,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -445,7 +410,7 @@ async def test_homekit_remove_accessory(hass, mock_zeroconf):
assert len(mock_bridge.accessories) == 0
async def test_homekit_entity_filter(hass):
async def test_homekit_entity_filter(hass, mock_zeroconf):
"""Test the entity filter."""
entry = await async_init_integration(hass)
@ -457,7 +422,6 @@ async def test_homekit_entity_filter(hass):
None,
entity_filter,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -480,7 +444,7 @@ async def test_homekit_entity_filter(hass):
assert mock_get_acc.called is False
async def test_homekit_entity_glob_filter(hass):
async def test_homekit_entity_glob_filter(hass, mock_zeroconf):
"""Test the entity filter."""
entry = await async_init_integration(hass)
@ -494,7 +458,6 @@ async def test_homekit_entity_glob_filter(hass):
None,
entity_filter,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -534,7 +497,6 @@ async def test_homekit_start(hass, hk_driver, device_reg, debounce_patcher):
None,
{},
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -611,7 +573,9 @@ async def test_homekit_start(hass, hk_driver, device_reg, debounce_patcher):
assert len(device_reg.devices) == 1
async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, debounce_patcher):
async def test_homekit_start_with_a_broken_accessory(
hass, hk_driver, debounce_patcher, mock_zeroconf
):
"""Test HomeKit start method."""
pin = b"123-45-678"
entry = MockConfigEntry(
@ -627,7 +591,6 @@ async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, debounce_p
None,
entity_filter,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -674,7 +637,6 @@ async def test_homekit_stop(hass):
None,
{},
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -702,7 +664,7 @@ async def test_homekit_stop(hass):
assert homekit.driver.async_stop.called is True
async def test_homekit_reset_accessories(hass):
async def test_homekit_reset_accessories(hass, mock_zeroconf):
"""Test adding too many accessories to HomeKit."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
@ -715,7 +677,6 @@ async def test_homekit_reset_accessories(hass):
None,
{},
{entity_id: {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -751,7 +712,7 @@ async def test_homekit_reset_accessories(hass):
homekit.status = STATUS_READY
async def test_homekit_too_many_accessories(hass, hk_driver, caplog):
async def test_homekit_too_many_accessories(hass, hk_driver, caplog, mock_zeroconf):
"""Test adding too many accessories to HomeKit."""
entry = await async_init_integration(hass)
@ -764,7 +725,6 @@ async def test_homekit_too_many_accessories(hass, hk_driver, caplog):
None,
entity_filter,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -794,7 +754,7 @@ async def test_homekit_too_many_accessories(hass, hk_driver, caplog):
async def test_homekit_finds_linked_batteries(
hass, hk_driver, debounce_patcher, device_reg, entity_reg
hass, hk_driver, debounce_patcher, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
@ -806,7 +766,6 @@ async def test_homekit_finds_linked_batteries(
None,
{},
{"light.demo": {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -881,7 +840,7 @@ async def test_homekit_finds_linked_batteries(
async def test_homekit_async_get_integration_fails(
hass, hk_driver, debounce_patcher, device_reg, entity_reg
hass, hk_driver, debounce_patcher, device_reg, entity_reg, mock_zeroconf
):
"""Test that we continue if async_get_integration fails."""
entry = await async_init_integration(hass)
@ -893,7 +852,6 @@ async def test_homekit_async_get_integration_fails(
None,
{},
{"light.demo": {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -966,7 +924,7 @@ async def test_homekit_async_get_integration_fails(
)
async def test_setup_imported(hass):
async def test_setup_imported(hass, mock_zeroconf):
"""Test async_setup with imported config options."""
legacy_persist_file_path = hass.config.path(HOMEKIT_FILE)
legacy_aid_storage_path = hass.config.path(STORAGE_DIR, "homekit.aids")
@ -1000,7 +958,6 @@ async def test_setup_imported(hass):
None,
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -1030,7 +987,7 @@ async def test_setup_imported(hass):
os.unlink(migrated_aid_file_path)
async def test_yaml_updates_update_config_entry_for_name(hass):
async def test_yaml_updates_update_config_entry_for_name(hass, mock_zeroconf):
"""Test async_setup with imported config."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -1055,7 +1012,6 @@ async def test_yaml_updates_update_config_entry_for_name(hass):
None,
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -1070,7 +1026,7 @@ async def test_yaml_updates_update_config_entry_for_name(hass):
mock_homekit().async_start.assert_called()
async def test_raise_config_entry_not_ready(hass):
async def test_raise_config_entry_not_ready(hass, mock_zeroconf):
"""Test async_setup when the port is not available."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -1116,7 +1072,7 @@ def _write_data(path: str, data: Dict) -> None:
async def test_homekit_ignored_missing_devices(
hass, hk_driver, debounce_patcher, device_reg, entity_reg
hass, hk_driver, debounce_patcher, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit handles a device in the entity registry but missing from the device registry."""
entry = await async_init_integration(hass)
@ -1128,7 +1084,6 @@ async def test_homekit_ignored_missing_devices(
None,
{},
{"light.demo": {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -1198,7 +1153,7 @@ async def test_homekit_ignored_missing_devices(
async def test_homekit_finds_linked_motion_sensors(
hass, hk_driver, debounce_patcher, device_reg, entity_reg
hass, hk_driver, debounce_patcher, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
@ -1210,7 +1165,6 @@ async def test_homekit_finds_linked_motion_sensors(
None,
{},
{"camera.camera_demo": {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -1274,7 +1228,7 @@ async def test_homekit_finds_linked_motion_sensors(
async def test_homekit_finds_linked_humidity_sensors(
hass, hk_driver, debounce_patcher, device_reg, entity_reg
hass, hk_driver, debounce_patcher, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
@ -1286,7 +1240,6 @@ async def test_homekit_finds_linked_humidity_sensors(
None,
{},
{"humidifier.humidifier": {}},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
advertise_ip=None,
entry_id=entry.entry_id,
@ -1351,7 +1304,7 @@ async def test_homekit_finds_linked_humidity_sensors(
)
async def test_reload(hass):
async def test_reload(hass, mock_zeroconf):
"""Test we can reload from yaml."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -1376,7 +1329,6 @@ async def test_reload(hass):
None,
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -1413,7 +1365,6 @@ async def test_reload(hass):
None,
ANY,
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_BRIDGE,
None,
entry.entry_id,
@ -1439,7 +1390,6 @@ async def test_homekit_start_in_accessory_mode(
None,
{},
{},
DEFAULT_SAFE_MODE,
HOMEKIT_MODE_ACCESSORY,
advertise_ip=None,
entry_id=entry.entry_id,