mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Fix stuck clients in UniFi options (#105028)
This commit is contained in:
parent
9b53fa6478
commit
4b87936779
@ -8,6 +8,7 @@ Configuration of options through options flow.
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
import operator
|
||||||
import socket
|
import socket
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -309,6 +310,11 @@ class UnifiOptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
client.mac: f"{client.name or client.hostname} ({client.mac})"
|
client.mac: f"{client.name or client.hostname} ({client.mac})"
|
||||||
for client in self.controller.api.clients.values()
|
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(
|
return self.async_show_form(
|
||||||
step_id="configure_entity_sources",
|
step_id="configure_entity_sources",
|
||||||
@ -317,7 +323,9 @@ class UnifiOptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_CLIENT_SOURCE,
|
CONF_CLIENT_SOURCE,
|
||||||
default=self.options.get(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,
|
last_step=False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user