Switch elkm1 to use integration discovery (#66572)

This commit is contained in:
J. Nick Koston 2022-02-15 16:18:55 -06:00 committed by GitHub
parent b28754e5fe
commit d79d775d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -126,10 +126,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
return await self._async_handle_discovery()
async def async_step_discovery(
async def async_step_integration_discovery(
self, discovery_info: DiscoveryInfoType
) -> FlowResult:
"""Handle discovery."""
"""Handle integration discovery."""
self._discovered_device = ElkSystem(
discovery_info["mac_address"],
discovery_info["ip_address"],

View File

@ -88,7 +88,7 @@ def async_trigger_discovery(
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DISCOVERY},
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
data=asdict(device),
)
)

View File

@ -656,7 +656,7 @@ async def test_form_import_device_discovered(hass):
"source, data",
[
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
(config_entries.SOURCE_DISCOVERY, ELK_DISCOVERY_INFO),
(config_entries.SOURCE_INTEGRATION_DISCOVERY, ELK_DISCOVERY_INFO),
],
)
async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already_configured(
@ -686,7 +686,7 @@ async def test_discovered_by_dhcp_or_discovery_mac_address_mismatch_host_already
"source, data",
[
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
(config_entries.SOURCE_DISCOVERY, ELK_DISCOVERY_INFO),
(config_entries.SOURCE_INTEGRATION_DISCOVERY, ELK_DISCOVERY_INFO),
],
)
async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id(
@ -717,7 +717,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
with _patch_discovery(), _patch_elk():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DISCOVERY},
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
data=ELK_DISCOVERY_INFO,
)
await hass.async_block_till_done()
@ -755,7 +755,7 @@ async def test_discovered_by_discovery(hass):
with _patch_discovery(), _patch_elk():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DISCOVERY},
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
data=ELK_DISCOVERY_INFO,
)
await hass.async_block_till_done()
@ -806,7 +806,7 @@ async def test_discovered_by_discovery_url_already_configured(hass):
with _patch_discovery(), _patch_elk():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DISCOVERY},
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
data=ELK_DISCOVERY_INFO,
)
await hass.async_block_till_done()