Fix OctoPrint SSDP URL parsing and discovered values (#58698)
This commit is contained in:
parent
520a36aa51
commit
4b64b92dba
1 changed files with 6 additions and 4 deletions
|
@ -1,9 +1,9 @@
|
|||
"""Config flow for OctoPrint integration."""
|
||||
import logging
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from pyoctoprintapi import ApiError, OctoprintClient, OctoprintException
|
||||
import voluptuous as vol
|
||||
from yarl import URL
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow, exceptions
|
||||
from homeassistant.const import (
|
||||
|
@ -162,14 +162,16 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
await self.async_set_unique_id(uuid)
|
||||
self._abort_if_unique_id_configured()
|
||||
|
||||
url = urlsplit(discovery_info["presentationURL"])
|
||||
url = URL(discovery_info["presentationURL"])
|
||||
self.context["title_placeholders"] = {
|
||||
CONF_HOST: url.hostname,
|
||||
CONF_HOST: url.host,
|
||||
}
|
||||
|
||||
self.discovery_schema = _schema_with_defaults(
|
||||
host=url.hostname,
|
||||
host=url.host,
|
||||
path=url.path,
|
||||
port=url.port,
|
||||
ssl=url.scheme == "https",
|
||||
)
|
||||
|
||||
return await self.async_step_user()
|
||||
|
|
Loading…
Add table
Reference in a new issue