1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Expose Axis device configuration url from discovered entry (#64517)

This commit is contained in:
Robert Svensson 2022-01-20 09:47:02 +01:00 committed by GitHub
parent 66c2520a94
commit 1551da33ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -205,10 +205,15 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=AXIS_DOMAIN):
}
)
self.context["title_placeholders"] = {
CONF_NAME: device[CONF_NAME],
CONF_HOST: device[CONF_HOST],
}
self.context.update(
{
"title_placeholders": {
CONF_NAME: device[CONF_NAME],
CONF_HOST: device[CONF_HOST],
},
"configuration_url": f"http://{device[CONF_HOST]}:{device[CONF_PORT]}",
}
)
self.discovery_schema = {
vol.Required(CONF_HOST, default=device[CONF_HOST]): str,

View File

@ -319,6 +319,10 @@ async def test_discovery_flow(hass, source: str, discovery_info: dict):
assert result["type"] == RESULT_TYPE_FORM
assert result["step_id"] == SOURCE_USER
flows = hass.config_entries.flow.async_progress()
assert len(flows) == 1
assert flows[0].get("context", {}).get("configuration_url") == "http://1.2.3.4:80"
with respx.mock:
mock_default_vapix_requests(respx)
result = await hass.config_entries.flow.async_configure(