Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stuck clients in UniFi options #105028

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion homeassistant/components/unifi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from __future__ import annotations

from collections.abc import Mapping
import operator
import socket
from types import MappingProxyType
from typing import Any
Expand Down Expand Up @@ -309,6 +310,11 @@ async def async_step_configure_entity_sources(
client.mac: f"{client.name or client.hostname} ({client.mac})"
for client in self.controller.api.clients.values()
}
clients |= {
mac: f"Unknown ({mac})"
for mac in self.options.get(CONF_CLIENT_SOURCE, [])
if mac not in clients
}

return self.async_show_form(
step_id="configure_entity_sources",
Expand All @@ -317,7 +323,9 @@ async def async_step_configure_entity_sources(
vol.Optional(
CONF_CLIENT_SOURCE,
default=self.options.get(CONF_CLIENT_SOURCE, []),
): cv.multi_select(clients),
): cv.multi_select(
dict(sorted(clients.items(), key=operator.itemgetter(1)))
),
}
),
last_step=False,
Expand Down