-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split quirks loading from network and app initialization #121
Conversation
init gateway in tests rearrange
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #121 +/- ##
==========================================
- Coverage 95.65% 95.65% -0.01%
==========================================
Files 61 61
Lines 9255 9254 -1
==========================================
- Hits 8853 8852 -1
Misses 402 402 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this part pf the gateway code at all? Quirks are global.
@elupus Custom quirks are reloaded from disk. This is also sort of a remnant of ZHA in Core. |
Sure, but it does not need to be done inside the gateway class. Could be done outside of that by the caller constructor of the gateway object. |
What i mean is, if we are changing it, it is better to remove it from gateway and make it a caller responsibility. Makes testing easier. |
I don't have a strong opinion either way. My initial view was that the gateway should essentially function as a standalone application. Take HA out of the picture and you should be able to take the gateway and just use it. I already have plans to eventually have an add-on and we are also used by another automation platform (they use all the libs and hand rolled what is essentially this lib now... hopefully the convert too). Initial thinking was anything that would be common across all would be done in 1 spot 🤷🏻♂️ |
Quirk loading is also somewhat tied to the lifecycle of |
This PR moves the loading of quirks so that we can split the quirk loading from the initialization of the network and the application. There are a couple HA users that hit an issue in the beta where device triggers from quirks aren't available early enough and if the integration fails to set up on the first shot (flaky stick, poor nwk conditions etc.) it prevents automations from finding triggers for ZHA devices:
There is a corresponding HA PR: home-assistant/core#123027