diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index d3ad8c702fa..2b56a056821 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -302,10 +302,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.debug("Begin setup HomeKit for %s", name) # ip_address and advertise_ip are yaml only - ip_address = conf.get( - CONF_IP_ADDRESS, await network.async_get_source_ip(hass, MDNS_TARGET_IP) + ip_address = conf.get(CONF_IP_ADDRESS, [None]) + advertise_ip = conf.get( + CONF_ADVERTISE_IP, await network.async_get_source_ip(hass, MDNS_TARGET_IP) ) - advertise_ip = conf.get(CONF_ADVERTISE_IP) # exclude_accessory_mode is only used for config flow # to indicate that the config entry was setup after # we started creating config entries for entities that diff --git a/tests/components/homekit/test_homekit.py b/tests/components/homekit/test_homekit.py index 94885722151..773dd171511 100644 --- a/tests/components/homekit/test_homekit.py +++ b/tests/components/homekit/test_homekit.py @@ -164,12 +164,12 @@ async def test_setup_min(hass: HomeAssistant, mock_async_zeroconf: None) -> None hass, BRIDGE_NAME, DEFAULT_PORT, - "1.2.3.4", + [None], ANY, ANY, {}, HOMEKIT_MODE_BRIDGE, - None, + "1.2.3.4", entry.entry_id, entry.title, devices=[], @@ -206,12 +206,12 @@ async def test_removing_entry( hass, BRIDGE_NAME, DEFAULT_PORT, - "1.2.3.4", + [None], ANY, ANY, {}, HOMEKIT_MODE_BRIDGE, - None, + "1.2.3.4", entry.entry_id, entry.title, devices=[], @@ -1476,12 +1476,12 @@ async def test_yaml_updates_update_config_entry_for_name( hass, BRIDGE_NAME, 12345, - "1.2.3.4", + [None], ANY, ANY, {}, HOMEKIT_MODE_BRIDGE, - None, + "1.2.3.4", entry.entry_id, entry.title, devices=[], @@ -1834,12 +1834,12 @@ async def test_reload(hass: HomeAssistant, mock_async_zeroconf: None) -> None: hass, "reloadable", 12345, - "1.2.3.4", + [None], ANY, False, {}, HOMEKIT_MODE_BRIDGE, - None, + "1.2.3.4", entry.entry_id, entry.title, devices=[], @@ -1869,12 +1869,12 @@ async def test_reload(hass: HomeAssistant, mock_async_zeroconf: None) -> None: hass, "reloadable", 45678, - "1.2.3.4", + [None], ANY, False, {}, HOMEKIT_MODE_BRIDGE, - None, + "1.2.3.4", entry.entry_id, entry.title, devices=[],