Skip to content

New manual device trigger for LED and future device changes - #85

Merged
sirkirby merged 3 commits into
devfrom
device-triggers
Jul 28, 2025
Merged

New manual device trigger for LED and future device changes#85
sirkirby merged 3 commits into
devfrom
device-triggers

Conversation

@sirkirby

Copy link
Copy Markdown
Owner
  • Corrected typos in the coding standards section of the rules file.
  • Added a new copilot instructions file outlining the project structure, libraries, and coding standards for the custom Home Assistant integration.- Corrected typos in the coding standards section of the rules file.
  • Added a new copilot instructions file outlining the project structure, libraries, and coding standards for the custom Home Assistant integration.

This pull request introduces several updates to enhance functionality, improve maintainability, and fix minor issues in the custom Home Assistant integration for managing UniFi Network policies and rules. The most significant changes include adding device state change detection and triggers, updating project documentation, and fixing typographical errors in coding standards and comments.

Enhancements to Device State Management:

  • Added methods in coordinator.py to detect device state changes, such as LED toggles and connection state changes, and dispatch triggers using Home Assistant's dispatcher system (fire_device_trigger_via_dispatcher and _check_for_device_state_changes). [1] [2]
  • Updated switch.py to handle immediate device triggers for LED toggles, bypassing delayed verification for faster feedback. [1] [2]
  • Introduced a new trigger type device_changed in trigger.py to support device-related events, including listener registration for dispatcher signals. [1] [2]

Documentation Updates:

  • Added a new .github/copilot-instructions.md file to provide an overview of the project, its structure, coding standards, and dependencies.

Typographical Fixes in Coding Standards:

  • Corrected multiple typographical errors in .cursor/rules/unr-rules.mdc to improve clarity and professionalism. Examples include fixing "fuctionality" to "functionality" and "retrived" to "retrieved." [1] [2]

Dependency and Version Updates:

  • Incremented the integration version in manifest.json from 3.1.0 to 3.2.0 to reflect the new features and fixes.

Minor Code Improvements:

  • Added LOG_TRIGGERS to relevant files (coordinator.py, switch.py, trigger.py) to enable logging for device triggers and improve debugging capabilities. [1] [2] [3]

sirkirby added 3 commits July 28, 2025 13:27
- Corrected typos in the coding standards section of the rules file.
- Added a new copilot instructions file outlining the project structure, libraries, and coding standards for the custom Home Assistant integration.
- Implemented a new method in `coordinator.py` to check for device state changes and fire corresponding triggers.
- Enhanced `fire_device_trigger_via_dispatcher` to dispatch device change events using Home Assistant's dispatcher pattern.
- Updated `switch.py` to fire immediate device triggers for LED toggles, improving responsiveness.
- Added support for device change triggers in `trigger.py`, allowing for manual firing and filtering based on device ID and change type.
- Improved logging for device trigger events to facilitate better monitoring and debugging.
- Introduced a new trigger for device changes to enhance the integration's capabilities.
- Updated the triggers.yaml file to include the 'device_changed' rule so HA properly registers the new trigger.
@sirkirby sirkirby self-assigned this Jul 28, 2025
@sirkirby
sirkirby marked this pull request as ready for review July 28, 2025 17:55
@sirkirby
sirkirby merged commit 818a44d into dev Jul 28, 2025
9 checks passed
@sirkirby
sirkirby deleted the device-triggers branch July 28, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant