Handle Google Nest DHCP flows (#145658)

* Handle Google Nest DHCP flows

* Handle Google Nest DHCP flows
This commit is contained in:
Joost Lekkerkerker 2025-05-27 00:01:35 +02:00 committed by GitHub
parent 1e3d06a993
commit df35f30321
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -446,4 +446,5 @@ class NestFlowHandler(
self, discovery_info: DhcpServiceInfo self, discovery_info: DhcpServiceInfo
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a flow initialized by discovery.""" """Handle a flow initialized by discovery."""
await self._async_handle_discovery_without_unique_id()
return await self.async_step_user() return await self.async_step_user()

View File

@ -1002,6 +1002,24 @@ async def test_dhcp_discovery(
assert result.get("reason") == "missing_credentials" assert result.get("reason") == "missing_credentials"
@pytest.mark.parametrize(
("nest_test_config", "sdm_managed_topic", "device_access_project_id"),
[(TEST_CONFIG_APP_CREDS, True, "project-id-2")],
)
async def test_dhcp_discovery_already_setup(
hass: HomeAssistant, oauth: OAuthFixture, setup_platform
) -> None:
"""Exercise discovery dhcp with existing config entry."""
await setup_platform()
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},
data=FAKE_DHCP_DATA,
)
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
@pytest.mark.parametrize(("sdm_managed_topic"), [(True)]) @pytest.mark.parametrize(("sdm_managed_topic"), [(True)])
async def test_dhcp_discovery_with_creds( async def test_dhcp_discovery_with_creds(
hass: HomeAssistant, hass: HomeAssistant,