Skip to content

Commit cc1a7c8

Browse files
authored
Merge pull request #110 from sirkirby/hotfix/network-filter
Fixed double network filtering
2 parents 57a77d4 + a4ad443 commit cc1a7c8

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

  • custom_components/unifi_network_rules/helpers

custom_components/unifi_network_rules/helpers/rule.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -442,22 +442,10 @@ def get_rule_name(rule: Any, coordinator=None) -> str | None:
442442
elif isinstance(rule, Device):
443443
rule_type = "devices"
444444
elif isinstance(rule, NetworkConf):
445-
# Decide if this network should be exposed as a switch entity.
446-
# Omit VPN networks since we already have VPN switches.
447-
raw = getattr(rule, "raw", {}) if hasattr(rule, "raw") else {}
448-
purpose = str(raw.get("purpose", "")).lower()
449-
vpn_type = str(raw.get("vpn_type", "")).lower()
450-
is_vpn = (
451-
purpose.startswith("vpn")
452-
or purpose in {"remote-user-vpn", "vpn-client", "vpn-server"}
453-
or "vpn" in vpn_type
454-
or "wireguard" in vpn_type
455-
or "openvpn" in vpn_type
456-
)
457-
if is_vpn:
458-
rule_type = None # signal to caller there is no switch type
459-
else:
460-
rule_type = "networks"
445+
# NetworkConf objects passed here are already filtered by the coordinator
446+
# VPN networks are separated into vpn_clients/vpn_servers collections
447+
# So all NetworkConf objects should be treated as network switches
448+
rule_type = "networks"
461449
elif isinstance(rule, PortProfile):
462450
rule_type = "port_profiles"
463451
elif isinstance(rule, dict) and "type" in rule:

0 commit comments

Comments
 (0)