mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Switch tplink to use integration discovery (#66575)
This commit is contained in:
parent
59cb1444a5
commit
38b9bea9a3
@ -39,7 +39,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={
|
data={
|
||||||
CONF_NAME: device.alias,
|
CONF_NAME: device.alias,
|
||||||
CONF_HOST: device.host,
|
CONF_HOST: device.host,
|
||||||
|
@ -35,10 +35,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
discovery_info.ip, discovery_info.macaddress
|
discovery_info.ip, discovery_info.macaddress
|
||||||
)
|
)
|
||||||
|
|
||||||
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."""
|
||||||
return await self._async_handle_discovery(
|
return await self._async_handle_discovery(
|
||||||
discovery_info[CONF_HOST], discovery_info[CONF_MAC]
|
discovery_info[CONF_HOST], discovery_info[CONF_MAC]
|
||||||
)
|
)
|
||||||
|
@ -252,7 +252,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
|||||||
with _patch_discovery(), _patch_single_discovery():
|
with _patch_discovery(), _patch_single_discovery():
|
||||||
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={CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
data={CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -304,7 +304,7 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
|||||||
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS),
|
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
config_entries.SOURCE_DISCOVERY,
|
config_entries.SOURCE_INTEGRATION_DISCOVERY,
|
||||||
{CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
{CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -345,7 +345,7 @@ async def test_discovered_by_dhcp_or_discovery(hass, source, data):
|
|||||||
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS),
|
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
config_entries.SOURCE_DISCOVERY,
|
config_entries.SOURCE_INTEGRATION_DISCOVERY,
|
||||||
{CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
{CONF_HOST: IP_ADDRESS, CONF_MAC: MAC_ADDRESS, CONF_NAME: ALIAS},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user