Refactor Zaptec integration for prepping to adopt to API policy#203
Merged
sveinse merged 4 commits intocustom-components:masterfrom Jul 21, 2025
Merged
Conversation
…anization and maintainability - Introduced ZaptecManager to handle instance data and coordination of updates. - It is preparations for running multiple coordinators - Updated async_setup_entry to utilize the new manager - Refactored entity creation methods to be part of the manager - Adjusted all platform files (binary_sensor, button, lock, number, sensor, switch, update) to align with the new structure. - Cleaned up unnecessary imports and comments, enhancing code readability. - Removed YAML import step from config flow as it is no longer needed.
joostlek
suggested changes
Jul 19, 2025
* Check for zaptec attribute availability when creating the entity. If not available, skip the addition * Remove `ZaptecBaseEntity.async_added_to_hass()` - no longer needed * Fix how `ZaptecBaseEntity._handle_coordinator_update()` is managing error and logging - simplifies footprint in each entity * Make a specific error `KeyUnavailableError` for dealing with unreachable zaptec attributes * Update diagnostics. Now working for both device and config entry use.
Collaborator
Author
|
@steinmn If you have the opportunity, it would be great if you could take a look at this. I have (finally) a working fix for the proper poll intervals, but I cannot add the PR before this has been merged. |
steinmn
approved these changes
Jul 21, 2025
Contributor
steinmn
left a comment
There was a problem hiding this comment.
Just nitpicks/comments/questions from my side, so I'll mark it as approved and let you decide if you want to ignore them, address them in this PR or in a followup.
Collaborator
Author
|
Thank you @steinmn . Good feedback. I've pushed an update that fixes all of them. Since they are all nitpicks, we don't need to go another round of reviews. |
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 PR introduces a lot of refactoring to do several things
Detailed improvements:
async_setup_entry()to utilize the new managerZaptecBaseEntity._handle_coordinator_update()is managing error and logging - simplifies footprint in each entity