Skip to content
Snippets Groups Projects
Unverified Commit 4b64b92d authored by Franck Nijhof's avatar Franck Nijhof Committed by GitHub
Browse files

Fix OctoPrint SSDP URL parsing and discovered values (#58698)

parent 520a36aa
No related branches found
No related tags found
No related merge requests found
"""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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment