mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Switch elkm1 to use integration discovery (#66572)
This commit is contained in:
parent
b28754e5fe
commit
d79d775d92
@ -126,10 +126,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
return await self._async_handle_discovery()
|
return await self._async_handle_discovery()
|
||||||
|
|
||||||
async def async_step_discovery(
|
async def async_step_integration_discovery(
|
||||||
self, discovery_info: DiscoveryInfoType
|
self, discovery_info: DiscoveryInfoType
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle discovery."""
|
"""Handle integration discovery."""
|
||||||
self._discovered_device = ElkSystem(
|
self._discovered_device = ElkSystem(
|
||||||
discovery_info["mac_address"],
|
discovery_info["mac_address"],
|
||||||
discovery_info["ip_address"],
|
discovery_info["ip_address"],
|
||||||
|
@ -88,7 +88,7 @@ def async_trigger_discovery(
|
|||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.flow.async_init(
|
hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_DISCOVERY},
|
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||||
data=asdict(device),
|
data=asdict(device),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -656,7 +656,7 @@ async def test_form_import_device_discovered(hass):
|
|||||||
"source, data",
|
"source, data",
|
||||||
[
|
[
|
||||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
(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(
|
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",
|
"source, data",
|
||||||
[
|
[
|
||||||
(config_entries.SOURCE_DHCP, DHCP_DISCOVERY),
|
(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(
|
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():
|
with _patch_discovery(), _patch_elk():
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_DISCOVERY},
|
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||||
data=ELK_DISCOVERY_INFO,
|
data=ELK_DISCOVERY_INFO,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -755,7 +755,7 @@ async def test_discovered_by_discovery(hass):
|
|||||||
with _patch_discovery(), _patch_elk():
|
with _patch_discovery(), _patch_elk():
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_DISCOVERY},
|
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||||
data=ELK_DISCOVERY_INFO,
|
data=ELK_DISCOVERY_INFO,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
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():
|
with _patch_discovery(), _patch_elk():
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_DISCOVERY},
|
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||||
data=ELK_DISCOVERY_INFO,
|
data=ELK_DISCOVERY_INFO,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user