Expose UniFi controller configuration url from discovered entry (#64514)

This commit is contained in:
Robert Svensson 2022-01-20 09:34:54 +01:00 committed by GitHub
parent 2b413b86a3
commit 86d32b3440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -238,6 +238,9 @@ class UnifiFlowHandler(config_entries.ConfigFlow, domain=UNIFI_DOMAIN):
if (port := MODEL_PORTS.get(model_description)) is not None:
self.config[CONF_PORT] = port
self.context[
"configuration_url"
] = f"https://{self.config[CONF_HOST]}:{port}"
return await self.async_step_user()

View file

@ -562,6 +562,15 @@ async def test_form_ssdp(hass):
assert result["type"] == "form"
assert result["step_id"] == "user"
assert result["errors"] == {}
flows = hass.config_entries.flow.async_progress()
assert len(flows) == 1
assert (
flows[0].get("context", {}).get("configuration_url")
== "https://192.168.208.1:443"
)
context = next(
flow["context"]
for flow in hass.config_entries.flow.async_progress()