mirror of
https://github.com/home-assistant/core.git
synced 2025-06-26 16:07:08 +00:00
Fix OctoPrint SSDP URL parsing and discovered values (#58698)
This commit is contained in:
parent
520a36aa51
commit
4b64b92dba
@ -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…
x
Reference in New Issue
Block a user