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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphaned MAC addresses breaks UniFi options flow #64327

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
14 changes: 12 additions & 2 deletions homeassistant/components/unifi/config_flow.py
Expand Up @@ -316,6 +316,10 @@ async def async_step_device_tracker(self, user_input=None):
)
ssid_filter = {ssid: ssid for ssid in sorted(ssids)}

selected_ssids_to_filter = [
ssid for ssid in self.controller.option_ssid_filter if ssid in ssid_filter
]

return self.async_show_form(
step_id="device_tracker",
data_schema=vol.Schema(
Expand All @@ -333,7 +337,7 @@ async def async_step_device_tracker(self, user_input=None):
default=self.controller.option_track_devices,
): bool,
vol.Optional(
CONF_SSID_FILTER, default=self.controller.option_ssid_filter
CONF_SSID_FILTER, default=selected_ssids_to_filter
): cv.multi_select(ssid_filter),
vol.Optional(
CONF_DETECTION_TIME,
Expand Down Expand Up @@ -365,12 +369,18 @@ async def async_step_client_control(self, user_input=None):
client.mac
] = f"{client.name or client.hostname} ({client.mac})"

selected_clients_to_block = [
client
for client in self.options.get(CONF_BLOCK_CLIENT, [])
if client in clients_to_block
]

return self.async_show_form(
step_id="client_control",
data_schema=vol.Schema(
{
vol.Optional(
CONF_BLOCK_CLIENT, default=self.options[CONF_BLOCK_CLIENT]
CONF_BLOCK_CLIENT, default=selected_clients_to_block
): cv.multi_select(clients_to_block),
vol.Optional(
CONF_POE_CLIENTS,
Expand Down