mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Switch senseme to use integration discovery (#66576)
This commit is contained in:
parent
dd9992bfd6
commit
6ae2331805
@ -42,10 +42,10 @@ class SensemeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._discovered_device = device
|
self._discovered_device = device
|
||||||
return await self.async_step_discovery_confirm()
|
return await self.async_step_discovery_confirm()
|
||||||
|
|
||||||
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."""
|
||||||
uuid = discovery_info[CONF_ID]
|
uuid = discovery_info[CONF_ID]
|
||||||
device = async_get_discovered_device(self.hass, discovery_info[CONF_ID])
|
device = async_get_discovered_device(self.hass, discovery_info[CONF_ID])
|
||||||
host = device.address
|
host = device.address
|
||||||
|
@ -58,7 +58,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={CONF_ID: device.uuid},
|
data={CONF_ID: device.uuid},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -211,7 +211,7 @@ async def test_discovery(hass: HomeAssistant) -> None:
|
|||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
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_ID: MOCK_UUID},
|
data={CONF_ID: MOCK_UUID},
|
||||||
)
|
)
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
@ -254,7 +254,7 @@ async def test_discovery_existing_device_no_ip_change(hass: HomeAssistant) -> No
|
|||||||
with _patch_discovery():
|
with _patch_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_ID: MOCK_UUID},
|
data={CONF_ID: MOCK_UUID},
|
||||||
)
|
)
|
||||||
assert result["type"] == RESULT_TYPE_ABORT
|
assert result["type"] == RESULT_TYPE_ABORT
|
||||||
@ -281,7 +281,7 @@ async def test_discovery_existing_device_ip_change(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
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_ID: MOCK_UUID},
|
data={CONF_ID: MOCK_UUID},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user