mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Avoid probing configured ipp devices at discovery (#60551)
- Each time these were seen by zeroconf, these devices were probed even if they were already configured. This is expensive and we want to avoid this when possible
This commit is contained in:
parent
1bfd98ab14
commit
f0f88d56bd
@ -104,23 +104,28 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle zeroconf discovery."""
|
"""Handle zeroconf discovery."""
|
||||||
port = discovery_info[zeroconf.ATTR_PORT]
|
host = discovery_info.host
|
||||||
zctype = discovery_info[zeroconf.ATTR_TYPE]
|
|
||||||
name = discovery_info[zeroconf.ATTR_NAME].replace(f".{zctype}", "")
|
# Avoid probing devices that already have an entry
|
||||||
|
self._async_abort_entries_match({CONF_HOST: host})
|
||||||
|
|
||||||
|
port = discovery_info.port
|
||||||
|
zctype = discovery_info.type
|
||||||
|
name = discovery_info.name.replace(f".{zctype}", "")
|
||||||
tls = zctype == "_ipps._tcp.local."
|
tls = zctype == "_ipps._tcp.local."
|
||||||
base_path = discovery_info[zeroconf.ATTR_PROPERTIES].get("rp", "ipp/print")
|
base_path = discovery_info.properties.get("rp", "ipp/print")
|
||||||
|
|
||||||
self.context.update({"title_placeholders": {"name": name}})
|
self.context.update({"title_placeholders": {"name": name}})
|
||||||
|
|
||||||
self.discovery_info.update(
|
self.discovery_info.update(
|
||||||
{
|
{
|
||||||
CONF_HOST: discovery_info[zeroconf.ATTR_HOST],
|
CONF_HOST: host,
|
||||||
CONF_PORT: port,
|
CONF_PORT: port,
|
||||||
CONF_SSL: tls,
|
CONF_SSL: tls,
|
||||||
CONF_VERIFY_SSL: False,
|
CONF_VERIFY_SSL: False,
|
||||||
CONF_BASE_PATH: f"/{base_path}",
|
CONF_BASE_PATH: f"/{base_path}",
|
||||||
CONF_NAME: name,
|
CONF_NAME: name,
|
||||||
CONF_UUID: discovery_info[zeroconf.ATTR_PROPERTIES].get("UUID"),
|
CONF_UUID: discovery_info.properties.get("UUID"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user