Real time triggers - #68
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
scheduletrigger andvalidatejob from.github/workflows/hacs-integration.ymlto streamline the workflow. [1] [2].github/workflows/hass-validation.ymlfile to handle Home Assistant validation withhassfestas a separate workflow, including permissions for content, checks, pull requests, and statuses.Documentation Enhancements:
README.mdwith a comprehensive section on real-time triggers, including their features, setup instructions, YAML examples, and best practices for automation.LOG_TRIGGERSto the list of debug flags in the README for troubleshooting trigger-related issues.Logging Improvements:
LOG_TRIGGERSincustom_components/unifi_network_rules/const.pyto enable detailed logs for trigger detection and firing, with the default value set toTrue.Code Adjustment:
custom_components/unifi_network_rules/coordinator.pyto indicate that websocket processing is now handled by the trigger system, reflecting the refactored architecture.