Skip to content

Add support for network objects and profiles in UniFi integration - #97

Merged
sirkirby merged 2 commits into
devfrom
maintain_unifi_groups
Aug 20, 2025
Merged

Add support for network objects and profiles in UniFi integration#97
sirkirby merged 2 commits into
devfrom
maintain_unifi_groups

Conversation

@sirkirby

Copy link
Copy Markdown
Owner
  • Introduced new API endpoints and paths for managing network objects, port profiles, WLAN rate profiles, RADIUS profiles, and WAN SLA profiles.
  • Added a service to sync remote curated groups from specified URLs, enhancing firewall group management.
  • Updated the manifest version to 3.3.0 and required aiounifi version to 84.0.0.
  • Implemented mixins for handling various profile types and added utility functions for fetching and parsing curated lists.

fixes #89

This pull request introduces support for syncing curated firewall groups from remote text files, adds new models and API mixins for UniFi network objects, and updates the integration to use the latest aiounifi library. The changes primarily focus on enabling users to fetch and manage firewall groups (objects) from external sources, improving extensibility and automation.

Remote Curated Groups Sync Feature:

  • Added the sync_remote_curated service, allowing users to fetch curated firewall group lists from public raw URLs and create or update corresponding firewall groups in UniFi. This includes schema validation, parsing, and enforcement of type-specific members. (services.yaml, services/constants.py, services/system_services.py) [1] [2] [3]

Network Object Model and API Enhancements:

  • Introduced the NetworkObject model and related typed representations for firewall groups and their members, enabling structured handling of object data. (models/network_object.py)
  • Added the ObjectsMixin class to the UDM API, providing methods to list, add, update, and remove firewall groups as network objects. (udm/objects.py, udm/api.py) [1] [2]

Constants and Endpoint Updates:

  • Defined new API endpoints and path fragments for objects and profile management, supporting future expansion for other UniFi entities. (const.py) [1] [2]
  • Added new constants for service and configuration keys related to object sets and remote files. (services/constants.py)

Dependency and Version Updates:

  • Updated the minimum required aiounifi version to 84.0.0 and bumped the integration version to 3.3.0. (manifest.json)

These changes collectively enable the integration to automate firewall group management based on external curated lists, improve the internal data model for network objects, and prepare for further extensibility.

- Introduced new API endpoints and paths for managing network objects, port profiles, WLAN rate profiles, RADIUS profiles, and WAN SLA profiles.
- Added a service to sync remote curated groups from specified URLs, enhancing firewall group management.
- Updated the manifest version to 3.3.0 and required aiounifi version to 84.0.0.
- Implemented mixins for handling various profile types and added utility functions for fetching and parsing curated lists.
@sirkirby sirkirby self-assigned this Aug 18, 2025
@sirkirby
sirkirby requested a review from Copilot August 19, 2025 14:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for network objects and profiles in the UniFi Network Rules integration, introducing a new service for syncing curated firewall groups from remote URLs. The changes primarily expand the integration's API capabilities and enable automated firewall group management from external sources.

  • Added network objects model and API mixins for managing firewall groups and various profile types
  • Introduced a service to fetch and sync curated firewall groups from remote text files
  • Updated dependencies and version numbers to support new features

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
utils/remote_lists.py Added utility functions for building raw URLs from repository URLs and parsing curated list text files
udm/profiles.py Implemented mixins for managing port, WLAN rate, RADIUS, and WAN SLA profiles
udm/objects.py Added ObjectsMixin for managing firewall groups as network objects with CRUD operations
udm/api.py Extended UDMAPI class to inherit from new profile and object mixins
services/system_services.py Added sync_remote_curated service handler for fetching and processing remote firewall group lists
services/constants.py Added new service constants for remote curated group synchronization
services.yaml Added service definition for sync_remote_curated functionality
models/network_object.py Defined NetworkObject model and TypedDict structures for network objects
manifest.json Updated aiounifi dependency to version 84.0.0 and integration version to 3.3.0
const.py Added new API endpoints and path constants for objects and profiles

Comment thread custom_components/unifi_network_rules/utils/remote_lists.py
Comment thread custom_components/unifi_network_rules/utils/remote_lists.py
Comment thread custom_components/unifi_network_rules/utils/remote_lists.py
Comment thread custom_components/unifi_network_rules/udm/profiles.py Outdated
Comment thread custom_components/unifi_network_rules/udm/profiles.py Outdated
Comment thread custom_components/unifi_network_rules/udm/objects.py Outdated
Comment thread custom_components/unifi_network_rules/models/network_object.py Outdated
Comment thread custom_components/unifi_network_rules/models/network_object.py Outdated
Comment thread custom_components/unifi_network_rules/models/network_object.py Outdated
Comment thread custom_components/unifi_network_rules/models/network_object.py Outdated
@sirkirby sirkirby added the enhancement New feature or request label Aug 20, 2025
@sirkirby
sirkirby merged commit 7e56b29 into dev Aug 20, 2025
9 checks passed
@sirkirby
sirkirby deleted the maintain_unifi_groups branch August 20, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants