Skip to content

Commit

Permalink
Fix stuck clients in UniFi options (#105028)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kane610 authored and frenck committed Dec 5, 2023
1 parent 65c8aa3 commit 2f727d5
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 2f727d5

Please sign in to comment.