Fix steamist not setting unique id when discovered in user flow (#110915)

pull/105985/head^2
J. Nick Koston 2024-02-19 02:58:32 -06:00 committed by GitHub
parent a2bd59ab3b
commit 6fc764330f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -170,6 +170,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors["base"] = "unknown"
else:
if discovery := await async_discover_device(self.hass, host):
await self.async_set_unique_id(
dr.format_mac(discovery.mac), raise_on_progress=False
)
return self._async_create_entry_from_device(discovery)
self._async_abort_entries_match({CONF_HOST: host})
return self.async_create_entry(title=host, data=user_input)

View File

@ -91,6 +91,7 @@ async def test_form_with_discovery(hass: HomeAssistant) -> None:
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["title"] == DEVICE_NAME
assert result2["data"] == DEFAULT_ENTRY_DATA
assert result2["context"]["unique_id"] == FORMATTED_MAC_ADDRESS
assert len(mock_setup_entry.mock_calls) == 1