Skip to content

Real time triggers - #68

Merged
sirkirby merged 5 commits into
devfrom
real-time-triggers
Jun 30, 2025
Merged

Real time triggers#68
sirkirby merged 5 commits into
devfrom
real-time-triggers

Conversation

@sirkirby

Copy link
Copy Markdown
Owner

This pull request introduces a new real-time triggers which change how we work with the websocket connection to modify coordinator state in near real-time. the UDM is always the source of truth, so triggers only respond to state changes communicated by the UDM, whether they are initiated from Home Assistant or via the UDM interface, making for a robust and reliable trigger system that you can build complex automation for network security and policy management. Documentation has also been updated to highlight some examples on how to leverage the new system.

Workflow Updates:

  • Removed the schedule trigger and validate job from .github/workflows/hacs-integration.yml to streamline the workflow. [1] [2]
  • Added a new .github/workflows/hass-validation.yml file to handle Home Assistant validation with hassfest as a separate workflow, including permissions for content, checks, pull requests, and statuses.

Documentation Enhancements:

  • Expanded the README.md with a comprehensive section on real-time triggers, including their features, setup instructions, YAML examples, and best practices for automation.
  • Added LOG_TRIGGERS to the list of debug flags in the README for troubleshooting trigger-related issues.

Logging Improvements:

  • Introduced a new constant LOG_TRIGGERS in custom_components/unifi_network_rules/const.py to enable detailed logs for trigger detection and firing, with the default value set to True.

Code Adjustment:

  • Added a comment in custom_components/unifi_network_rules/coordinator.py to indicate that websocket processing is now handled by the trigger system, reflecting the refactored architecture.

sirkirby added 3 commits June 29, 2025 15:26
…m `hacs-integration.yml` and creating a new `hass-validation.yml` for dedicated Home Assistant validation. This improves workflow organization and clarity.
This update introduces a new trigger system to handle events related to UniFi Network rules, enhancing the integration's responsiveness to configuration changes. Key changes include:

- Addition of a `triggers.yaml` file defining various triggers for rule events (enabled, disabled, changed, deleted).
- Refactoring of the websocket message handling to integrate with the new trigger system, allowing for more efficient processing of rule-related events.
- Updates to the `coordinator.py` and `trigger.py` files to support the new trigger logic and improve logging for debugging purposes.
- Minor adjustments to the `manifest.json` to include the new trigger platform.

This enhancement improves the overall functionality and user experience of the UniFi Network Rules integration.
This update introduces a comprehensive real-time trigger system for UniFi Network Rules, allowing users to receive instant notifications on rule changes. Key changes include:

- Added a new section in `README.md` detailing the real-time triggers, their features, and setup instructions.
- Updated `trigger.py` to support device automation style schemas and improved logging for better debugging.
- Enabled detailed logging for trigger detection and processing, enhancing the ability to monitor rule changes.
- Updated `const.py` to enable trigger logging for state-diff debugging.
- Incremented version in `manifest.json` to 3.0.0 to reflect the significant enhancements.

These improvements significantly enhance the responsiveness and usability of the UniFi Network Rules integration.
@sirkirby sirkirby self-assigned this Jun 30, 2025
@sirkirby sirkirby added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 30, 2025
@sirkirby
sirkirby merged commit 63fb5ef into dev Jun 30, 2025
7 checks passed
@sirkirby
sirkirby deleted the real-time-triggers branch June 30, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant